1 2005-03-15 Richard Williamson <rjw@apple.com>
3 Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
5 Added JavaScript boolean to type that can be converted to
6 ObjC scalar parameters.
8 Reviewed by Ken Kocienda.
10 * bindings/objc/objc_utility.mm:
11 (KJS::Bindings::convertValueToObjcValue):
27 2005-02-21 Darin Adler <darin@apple.com>
29 * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
31 2005-02-17 Richard Williamson <rjw@apple.com>
33 Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
37 Reviewed by John Sullivan.
39 * bindings/jni/jni_runtime.cpp:
40 (JavaField::valueFromInstance):
44 2005-02-11 Richard Williamson <rjw@apple.com>
46 Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
48 Re-factored how 'native' wrappers for JS objects are created. The interpreter now
49 creates these wrappers. The WebCore subclass of the interpreter now overrides
50 createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
54 * bindings/c/c_utility.cpp:
55 (convertValueToNPVariant):
56 * bindings/jni/jni_instance.cpp:
57 (JavaInstance::invokeMethod):
58 * bindings/jni/jni_objc.mm:
59 (KJS::Bindings::dispatchJNICall):
60 * bindings/jni/jni_runtime.cpp:
61 (JavaField::valueFromInstance):
63 * bindings/objc/WebScriptObject.mm:
64 (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
65 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
66 * bindings/objc/WebScriptObjectPrivate.h:
67 * bindings/objc/objc_utility.h:
68 * bindings/objc/objc_utility.mm:
69 (KJS::Bindings::convertObjcValueToValue):
70 (KJS::Bindings::createObjcInstanceForValue):
71 * bindings/runtime.cpp:
72 (Instance::createBindingForLanguageInstance):
73 (Instance::createRuntimeObject):
74 (Instance::createLanguageInstanceForValue):
76 * kjs/interpreter.cpp:
77 (Interpreter::createLanguageInstanceForValue):
82 2005-02-10 Darin Adler <darin@apple.com>
84 "Reviewed" by Richard (he told me the file was obsolete).
86 - got rid of an obsolete file
88 * bindings/npsap.h: Removed.
94 2005-02-03 Richard Williamson <rjw@apple.com>
96 Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
98 Revert to old (and correct) behavior of returning runtime object
99 when passed as a parameter, rather than it's corresponding DOM
104 * bindings/objc/WebScriptObject.mm:
105 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
109 2005-01-28 Richard Williamson <rjw@apple.com>
111 Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
113 Only use special 'back door' property to get the runtime object if thisObj isn't
114 already a runtime object.
116 <gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
117 ClassInfo pointer instead.
121 * bindings/c/c_utility.cpp:
122 (convertValueToNPVariant):
123 * bindings/objc/WebScriptObject.mm:
124 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
125 * bindings/runtime_method.cpp:
126 (RuntimeMethodImp::call):
130 2005-01-26 Richard Williamson <rjw@apple.com>
132 Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
134 I added a member variable to ObjectImp. This changed it's size and consequently
135 hampered the optimizations built into the garbage collector. Objects no longer
136 fit within the allocators cell size, and thus allocation fell back to a slower
139 As a result of this fix I also dramatically cleaned up how runtime objects are
140 accessed. The path mostly *removes* code.
144 * bindings/runtime_method.cpp:
145 (RuntimeMethodImp::call):
146 * bindings/runtime_object.cpp:
147 (RuntimeObjectImp::get):
148 (RuntimeObjectImp::put):
149 (RuntimeObjectImp::canPut):
150 (RuntimeObjectImp::hasProperty):
151 (RuntimeObjectImp::defaultValue):
152 * bindings/runtime_object.h:
154 (KJS::ObjectImp::ObjectImp):
157 2005-01-20 Darin Adler <darin@apple.com>
159 Reviewed by me, changes by Han Ming Ong.
161 - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
163 * bindings/objc/WebScriptObjectPrivate.h: Make members public.
164 * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
166 2005-01-20 Richard Williamson <rjw@apple.com>
168 Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
170 The comprehensive fix for this problem requires new API, as described in 3965326. However,
171 given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
172 like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
173 implemented on the bound object.
177 * bindings/objc/objc_runtime.h:
178 * bindings/objc/objc_runtime.mm:
179 (ObjcFallbackObjectImp::type):
180 (ObjcFallbackObjectImp::implementsCall):
181 (ObjcFallbackObjectImp::toBoolean):
182 * bindings/testbindings.mm:
183 (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
184 (+[MyFirstInterface isKeyExcludedFromWebScript:]):
188 2005-01-19 Richard Williamson <rjw@apple.com>
190 Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
192 Fixed the following problems with LiveConnect that are demonstrated by the application
193 described in 3853676.
195 1. If a nil object is passed in an array from Java to JavaScript we will crash.
196 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
197 3. We will sometimes fail to find the correct static method ID.
201 * bindings/jni/jni_jsobject.cpp:
202 (JSObject::convertJObjectToValue):
203 (JSObject::listFromJArray):
204 * bindings/jni/jni_runtime.cpp:
205 (JavaField::valueFromInstance):
206 (JavaField::setValueToInstance):
207 * bindings/jni/jni_utility.cpp:
208 (KJS::Bindings::getMethodID):
209 (KJS::Bindings::convertValueToJValue):
210 * bindings/runtime_array.h:
212 2005-01-18 Richard Williamson <rjw@apple.com>
214 Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
216 Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
217 Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
218 Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
219 Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
221 We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
222 tags. Also, if any of these elements are named they can be accessed from the document or window objects.
223 Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
227 * bindings/objc/objc_instance.h:
228 * bindings/objc/objc_instance.mm:
229 (ObjcInstance::supportsSetValueOfUndefinedField):
230 * bindings/runtime.h:
231 (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
232 * bindings/runtime_object.cpp:
233 (RuntimeObjectImp::RuntimeObjectImp):
234 (RuntimeObjectImp::get):
235 (RuntimeObjectImp::put):
236 (RuntimeObjectImp::canPut):
237 (RuntimeObjectImp::hasProperty):
238 (RuntimeObjectImp::defaultValue):
239 * bindings/runtime_object.h:
240 (KJS::RuntimeObjectImp::fallbackObject):
242 (KJS::ObjectImp::ObjectImp):
244 (KJS::ObjectImp::forwardingScriptMessage):
245 (KJS::ObjectImp::setForwardingScriptMessage):
247 2005-01-18 Richard Williamson <rjw@apple.com>
249 Back out a change that was incorrectly committed yesterday.
253 * bindings/objc/objc_utility.mm:
254 (KJS::Bindings::convertValueToObjcValue):
256 2005-01-17 Richard Williamson <rjw@apple.com>
258 Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
260 Keep track of originating execution context and target execution
261 context for native JS object wrappers, and perform appropriate
264 Reviewed by David Harrison.
266 * bindings/NP_jsobject.cpp:
268 (_NPN_CreateScriptObject):
273 (_NPN_RemoveProperty):
277 * bindings/NP_jsobject.h:
278 * bindings/c/c_instance.cpp:
279 (CInstance::CInstance):
280 (CInstance::stringValue):
281 * bindings/c/c_instance.h:
282 * bindings/c/c_utility.cpp:
283 (convertValueToNPVariant):
284 * bindings/jni/jni_instance.cpp:
285 (JavaInstance::JavaInstance):
286 (JavaInstance::valueOf):
287 * bindings/jni/jni_instance.h:
288 * bindings/objc/WebScriptObject.mm:
289 (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
290 (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
291 (-[WebScriptObject KJS::Bindings::]):
292 (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
293 (-[WebScriptObject _isSafeScript]):
294 (-[WebScriptObject callWebScriptMethod:withArguments:]):
295 (-[WebScriptObject evaluateWebScript:]):
296 (-[WebScriptObject setValue:forKey:]):
297 (-[WebScriptObject valueForKey:]):
298 (-[WebScriptObject removeWebScriptKey:]):
299 (-[WebScriptObject stringRepresentation]):
300 (-[WebScriptObject webScriptValueAtIndex:]):
301 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
302 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
303 * bindings/objc/WebScriptObjectPrivate.h:
304 * bindings/objc/objc_instance.h:
305 * bindings/objc/objc_runtime.mm:
306 (convertValueToObjcObject):
307 * bindings/objc/objc_utility.mm:
308 (KJS::Bindings::convertValueToObjcValue):
309 * bindings/runtime.cpp:
310 (Instance::Instance):
311 (Instance::operator=):
312 * bindings/runtime.h:
313 (KJS::Bindings::Instance::Instance):
314 (KJS::Bindings::Instance::setExecutionContext):
315 (KJS::Bindings::Instance::executionContext):
316 * bindings/runtime_root.cpp:
317 (RootObject::setInterpreter):
318 * bindings/runtime_root.h:
320 (KJS::Interpreter::isGlobalObject):
321 (KJS::Interpreter::interpreterForGlobalObject):
322 (KJS::Interpreter::isSafeScript):
326 2005-01-13 Vicki Murley <vicki@apple.com>
330 - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
332 * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
334 2005-01-12 Richard Williamson <rjw@apple.com>
336 Avoid additional work on dealloc by adding early out to
337 removeNativeReference(). (This will save time on dealloc
338 for all ObjC DOM objects.)
342 * bindings/runtime_root.cpp:
343 (KJS::Bindings::removeNativeReference):
345 2005-01-12 Richard Williamson <rjw@apple.com>
347 Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
349 We were always returning the first "root" object for all runtime
350 objects. Changed 0 in loop to i, the index.
352 Reviewed by David Harrison.
354 * bindings/runtime_root.cpp:
355 (KJS::Bindings::rootForImp):
357 2005-01-11 Richard Williamson <rjw@apple.com>
359 Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
361 Use the new dispatching API to invoke JNI, rather than calling JNI
364 Reviewed by David Harrison.
366 * bindings/jni/jni_instance.cpp:
367 (JavaInstance::invokeMethod):
368 * bindings/jni/jni_runtime.cpp:
369 (JavaField::dispatchValueFromInstance):
370 (JavaField::valueFromInstance):
371 (JavaField::dispatchSetValueToInstance):
372 (JavaField::setValueToInstance):
373 * bindings/jni/jni_runtime.h:
374 * bindings/jni/jni_utility.cpp:
375 (KJS::Bindings::convertValueToJValue):
383 2004-12-17 Maciej Stachowiak <mjs@apple.com>
387 <rdar://problem/3926869> Opening caches window after running PLT causes crash
389 * kjs/protected_values.cpp:
390 (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
391 the protected value table.
392 (KJS::ProtectedValues::increaseProtectCount): Ditto.
393 (KJS::ProtectedValues::decreaseProtectCount): Ditto.
395 2004-12-16 Darin Adler <darin@apple.com>
399 - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
401 * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
402 * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
403 non-locale-specific versions.
404 * kjs/string_object.lut.h: Regenerated.
406 2004-12-14 Richard Williamson <rjw@apple.com>
408 Pass URL of plugin view when call into JNI.
412 * bindings/jni/jni_objc.mm:
413 (KJS::Bindings::dispatchJNICall):
415 2004-12-13 Richard Williamson <rjw@apple.com>
417 Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
419 Add support for calling static Java methods from JavaScript.
423 * bindings/jni/jni_instance.cpp:
424 (JavaInstance::invokeMethod):
425 * bindings/jni/jni_runtime.cpp:
426 (JavaMethod::JavaMethod):
427 * bindings/jni/jni_runtime.h:
428 (KJS::Bindings::JavaMethod::isStatic):
429 * bindings/jni/jni_utility.cpp:
430 (callJNIStaticMethod):
431 (KJS::Bindings::callJNIBooleanMethod):
432 (KJS::Bindings::callJNIStaticBooleanMethod):
433 * bindings/jni/jni_utility.h:
435 2004-12-13 Richard Williamson <rjw@apple.com>
437 Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
441 * bindings/jni/jni_instance.cpp:
442 (JavaInstance::invokeMethod):
443 * bindings/jni/jni_objc.mm:
444 (KJS::Bindings::dispatchJNICall):
445 * bindings/jni/jni_runtime.h:
446 * bindings/jni/jni_utility.h:
450 2004-12-07 Maciej Stachowiak <mjs@apple.com>
454 <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
456 The fix was to implement copy constructor and assignment operator,
457 the ones that worked on the base class did not replace the
461 (KJS::ProtectedValue::ProtectedValue):
462 (KJS::ProtectedValue::operator=):
463 (KJS::ProtectedObject::ProtectedObject):
464 (KJS::ProtectedObject::operator=):
466 Also fixed a bug in the GC test mode that compares the results of
467 the old collector and the new collector.
474 2004-11-23 Richard Williamson <rjw@apple.com>
476 Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
480 * bindings/c/c_class.cpp:
481 (CClass::_commonInit):
483 2004-11-21 Maciej Stachowiak <mjs@apple.com>
487 <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
490 (KJS::Collector::Thread::Thread):
491 (KJS::destroyRegisteredThread):
492 (KJS::initializeRegisteredThreadKey):
493 (KJS::Collector::registerThread):
494 (KJS::Collector::markStackObjectsConservatively):
495 (KJS::Collector::markCurrentThreadConservatively):
496 (KJS::Collector::markOtherThreadConservatively):
504 2004-11-15 Richard Williamson <rjw@apple.com>
506 Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
510 * bindings/objc/objc_instance.mm:
511 (ObjcInstance::stringValue):
512 * bindings/objc/objc_utility.h:
513 * bindings/objc/objc_utility.mm:
514 (KJS::Bindings::convertNSStringToString):
515 (KJS::Bindings::convertObjcValueToValue):
519 2004-11-09 Chris Blumenberg <cblu@apple.com>
521 Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
526 * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
527 * bindings/softlinking.c: Added.
529 (getFunctionPointer): new
530 (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
534 2004-11-04 Darin Adler <darin@apple.com>
538 - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
539 - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
540 and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
541 than allocating a new one
543 * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
544 (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
545 of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
546 actually allocate only the very first time it's called.
547 (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
548 shared instance since there can be only one).
549 (-[WebUndefined copyWithZone:]): Ditto.
550 (-[WebUndefined retain]): Ditto.
551 (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
553 (-[WebUndefined autorelease]): Simplified to just return self (see above).
554 (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
555 (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
556 a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
557 bug mentioned above).
558 (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
559 No need to call init, since that's a no-op for this class.
561 2004-11-03 David Harrison <harrison@apple.com>
565 Eliminate the use of a marker file to determine how to build.
570 2004-11-01 Richard Williamson <rjw@apple.com>
572 Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
576 * bindings/c/c_instance.cpp:
577 (CInstance::invokeMethod):
578 (CInstance::invokeDefaultMethod):
579 Initialize out parameters to void type.
581 * bindings/c/c_runtime.cpp:
582 (CField::valueFromInstance):
583 (CField::setValueToInstance):
584 Initialize out parameters to void type.
585 Also added additional checks to protect against classes that
586 don't implement all functions.
588 2004-11-01 Richard Williamson <rjw@apple.com>
590 Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
595 * bindings/objc/WebScriptObject.mm:
596 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
597 Added additional conversion Undefined -> WebUndefined.
598 * bindings/objc/objc_utility.mm:
599 (KJS::Bindings::convertObjcValueToValue):
600 Added additional conversion WebUndefined -> Undefined.
602 2004-11-01 Darin Adler <darin@apple.com>
604 - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
606 * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
607 this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
608 report to match the contents of the file.
614 2004-10-22 Ken Kocienda <kocienda@apple.com>
618 * JavaScriptCore.pbproj/project.pbxproj:
619 Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
623 2004-10-13 Richard Williamson <rjw@apple.com>
625 Moved boolean checks prior to NSNumber checks. booleans are
628 Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
632 * bindings/objc/objc_utility.mm:
633 (KJS::Bindings::convertObjcValueToValue):
635 2004-10-12 Richard Williamson <rjw@apple.com>
637 Fixed access to DOM object via WebScriptObject API.
638 The execution context for DOM objects wasn't being found.
639 <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
643 * bindings/objc/WebScriptObject.mm:
645 (-[WebScriptObject KJS::Bindings::]):
646 (-[WebScriptObject callWebScriptMethod:withArguments:]):
647 (-[WebScriptObject evaluateWebScript:]):
648 (-[WebScriptObject setValue:forKey:]):
649 (-[WebScriptObject valueForKey:]):
650 (-[WebScriptObject stringRepresentation]):
651 * bindings/objc/WebScriptObjectPrivate.h:
653 2004-10-09 Darin Adler <darin@apple.com>
657 - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
659 * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
660 creating an init routine.
662 * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
663 require a global constructor that creates an init routine.
665 2004-10-09 Darin Adler <darin@apple.com>
669 - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
671 * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
672 work with the window object of the page the function is in, not the page of the caller. This
673 is what all other browsers do. This code was hidden before by the "everything is defined on
674 window object" hack in WebCore.
676 2004-10-07 Richard Williamson <rjw@apple.com>
678 Added simple JavaScript call tracing. Very useful for
679 debugging complex pages.
681 Tracing is only available in development builds and is
684 (gdb) set traceJavaScript = 1
688 setTraceJavaScript(true)
690 Function, args, and return values are printed to console. Very
695 * kjs/function_object.cpp:
696 (FunctionProtoFuncImp::call):
702 2004-10-05 Richard Williamson <rjw@apple.com>
704 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
708 * bindings/NP_jsobject.cpp:
710 * bindings/npruntime.cpp:
711 (_NPN_SetExceptionWithUTF8):
712 * bindings/objc/WebScriptObject.mm:
713 (+[WebScriptObject throwException:]):
715 (KJS::InterpreterImp::context):
717 2004-10-05 Richard Williamson <rjw@apple.com>
719 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
723 * bindings/objc/objc_utility.mm:
724 (KJS::Bindings::convertObjcValueToValue):
726 2004-10-04 Darin Adler <darin@apple.com>
730 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
732 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
734 - rolled out an old workaround we don't need any more
736 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
737 required it is no longer there.
739 2004-09-30 Richard Williamson <rjw@apple.com>
741 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
745 * bindings/NP_jsobject.cpp:
749 * bindings/c/c_class.cpp:
750 (CClass::methodsNamed):
751 (CClass::fieldNamed):
752 * bindings/c/c_class.h:
753 * bindings/c/c_instance.cpp:
754 (CInstance::invokeMethod):
755 * bindings/jni/jni_class.cpp:
756 (JavaClass::methodsNamed):
757 * bindings/jni/jni_class.h:
758 * bindings/npruntime.h:
759 * bindings/objc/objc_class.h:
760 * bindings/objc/objc_class.mm:
761 (ObjcClass::methodsNamed):
762 * bindings/runtime.h:
763 * bindings/runtime_object.cpp:
764 (RuntimeObjectImp::get):
765 (RuntimeObjectImp::hasProperty):
767 2004-09-29 Chris Blumenberg <cblu@apple.com>
769 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.
773 * JavaScriptCore.pbproj/project.pbxproj:
774 * bindings/NP_jsobject.cpp:
775 (_NPN_CreateScriptObject):
776 (_NPN_InvokeDefault):
781 (_NPN_RemoveProperty):
784 * bindings/c/c_class.cpp:
785 (CClass::methodsNamed):
786 (CClass::fieldNamed):
787 * bindings/c/c_instance.cpp:
788 (CInstance::CInstance):
789 (CInstance::~CInstance):
790 (CInstance::operator=):
791 (CInstance::invokeMethod):
792 (CInstance::invokeDefaultMethod):
793 * bindings/c/c_runtime.cpp:
794 * bindings/c/c_runtime.h:
795 (KJS::Bindings::CField::name):
796 (KJS::Bindings::CMethod::name):
797 * bindings/npruntime.cpp:
798 (_NPN_GetStringIdentifier):
799 (_NPN_GetStringIdentifiers):
800 (_NPN_GetIntIdentifier):
801 (_NPN_IdentifierIsString):
802 (_NPN_UTF8FromIdentifier):
803 (_NPN_IntFromIdentifier):
804 (NPN_InitializeVariantWithObject):
805 (_NPN_ReleaseVariantValue):
808 (_NPN_ReleaseObject):
809 (_NPN_SetExceptionWithUTF8):
812 2004-09-26 Darin Adler <darin@apple.com>
814 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
815 low() to get Unicode value of character, and just use unicode().
817 2004-09-26 Darin Adler <darin@apple.com>
819 - refine charAt/charCodeAt fix slightly
821 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
822 omitted parameter, as we do everywhere else, and as other browsers do here.
824 2004-09-26 Darin Adler <darin@apple.com>
828 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
830 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
831 the program. We were doing this properly for functions, but not entire programs.
833 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
835 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
836 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
838 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
844 2004-09-14 Richard Williamson <rjw@apple.com>
846 1. Add class parameter to object allocation function. This is somewhat redundant, given that
847 the allocation function is in the class function vector, but people wanted to use the same
848 allocation function for different classes.
850 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
852 3. Add support for a default function on an object. This is a feature that ActiveX supports,
853 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
854 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
855 'Objective-C' bindings.
857 There bugs are covered by
859 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
860 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
861 <rdar://problem/3674754> Need to implement latest npruntime.h
865 * bindings/NP_jsobject.cpp:
869 * bindings/c/c_class.cpp:
870 * bindings/c/c_instance.cpp:
871 (CInstance::CInstance):
872 (CInstance::operator=):
873 (CInstance::invokeMethod):
874 (CInstance::invokeDefaultMethod):
875 * bindings/c/c_instance.h:
876 * bindings/c/c_runtime.cpp:
877 * bindings/c/c_runtime.h:
878 * bindings/jni/jni_instance.cpp:
879 (JavaInstance::invokeDefaultMethod):
880 * bindings/jni/jni_instance.h:
881 * bindings/npruntime.cpp:
883 * bindings/npruntime.h:
884 * bindings/objc/WebScriptObject.h:
885 * bindings/objc/objc_class.mm:
886 (ObjcClass::fallbackObject):
887 * bindings/objc/objc_instance.h:
888 * bindings/objc/objc_instance.mm:
889 (ObjcInstance::invokeDefaultMethod):
890 * bindings/objc/objc_runtime.h:
891 * bindings/objc/objc_runtime.mm:
892 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
893 (ObjcFallbackObjectImp::get):
894 (ObjcFallbackObjectImp::put):
895 (ObjcFallbackObjectImp::canPut):
896 (ObjcFallbackObjectImp::implementsCall):
897 (ObjcFallbackObjectImp::call):
898 (ObjcFallbackObjectImp::hasProperty):
899 (ObjcFallbackObjectImp::deleteProperty):
900 (ObjcFallbackObjectImp::defaultValue):
901 * bindings/runtime.h:
902 (KJS::Bindings::Class::fallbackObject):
903 (KJS::Bindings::Instance::getValueOfUndefinedField):
904 (KJS::Bindings::Instance::setValueOfUndefinedField):
905 (KJS::Bindings::Instance::valueOf):
906 * bindings/runtime_object.cpp:
907 (RuntimeObjectImp::implementsCall):
908 (RuntimeObjectImp::call):
909 * bindings/runtime_object.h:
911 2004-09-13 Maciej Stachowiak <mjs@apple.com>
915 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
917 * kjs/string_object.cpp:
918 (StringProtoFuncImp::call): Replaced implementation of replace()
919 method with function below...
920 (replace): In order to avoid excessive allocation and copying,
921 figure out the ranges of the original string and replacement
922 strings to be assembled, instead of constantly creating new
923 strings at each substitution. The old behavior is basically O(N^2)
924 for a global replace on a pattern that matches many places in the
926 (regExpIsGlobal): Helper function for the above.
927 (expandSourceRanges): ditto
928 (pushSourceRange): ditto
929 (expandReplacements): ditto
930 (pushReplacement): ditto
932 (KJS::UString::spliceSubstringsWithSeparators): New method that
933 pieces together substring ranges of this string together with
934 specified separators, all at one go.
936 (KJS::UString::Range::Range): Added new helper class to represent
939 2004-09-14 Maciej Stachowiak <mjs@apple.com>
943 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
946 (KJS::GlobalFuncImp::call): Make sure to escape null
947 characters. This is a bug in the new code that made part of the
950 2004-09-13 Darin Adler <darin@apple.com>
952 Reviewed by Kevin and Maciej.
954 - new function to support fix for DIG bug in WebCore
956 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
957 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
959 2004-09-12 Darin Adler <darin@apple.com>
961 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
962 of escape and unescape.
964 2004-09-12 Darin Adler <darin@apple.com>
968 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
970 * kjs/date_object.cpp:
971 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
972 uses CFDateFormatter.
973 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
975 2004-09-09 Maciej Stachowiak <mjs@apple.com>
979 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
982 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
983 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
985 (Lexer::isHexDigit): Made static and non-const.
990 2004-09-06 Darin Adler <darin@apple.com>
992 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
996 2004-09-01 Richard Williamson <rjw@apple.com>
998 Add pid to exception messages (to help debug dashboard clients).
1002 * kjs/interpreter.cpp:
1003 (Interpreter::evaluate):
1007 2004-08-20 Richard Williamson <rjw@apple.com>
1009 Implemented new JNI abstraction. We no longer invoke Java methods
1010 directly with JNI, rather we call into the plugin. This allows the
1011 plugin to dispatch the call to the appropriate VM thread. This
1012 change should (will?) fix a whole class of threading related problems with
1017 * JavaScriptCore.pbproj/project.pbxproj:
1018 * bindings/c/c_instance.h:
1019 (KJS::Bindings::CInstance::setExecutionContext):
1020 (KJS::Bindings::CInstance::executionContext):
1021 * bindings/jni/jni_instance.cpp:
1022 (JavaInstance::JavaInstance):
1023 (JavaInstance::invokeMethod):
1024 (JavaInstance::setExecutionContext):
1025 (JavaInstance::executionContext):
1026 * bindings/jni/jni_instance.h:
1027 * bindings/jni/jni_jsobject.cpp:
1028 (JSObject::convertJObjectToValue):
1029 * bindings/jni/jni_runtime.cpp:
1030 (JavaField::JavaField):
1031 (JavaArray::convertJObjectToArray):
1032 (JavaField::valueFromInstance):
1033 (JavaArray::JavaArray):
1034 (JavaArray::valueAt):
1035 * bindings/jni/jni_runtime.h:
1036 (KJS::Bindings::JavaArray::operator=):
1037 (KJS::Bindings::JavaArray::executionContext):
1038 * bindings/jni/jni_utility.h:
1039 * bindings/objc/objc_instance.h:
1040 (KJS::Bindings::ObjcInstance::setExecutionContext):
1041 (KJS::Bindings::ObjcInstance::executionContext):
1042 * bindings/runtime.cpp:
1043 (Instance::createBindingForLanguageInstance):
1044 * bindings/runtime.h:
1045 * bindings/runtime_root.h:
1046 (KJS::Bindings::RootObject::nativeHandle):
1050 2004-08-19 Vicki Murley <vicki@apple.com>
1054 * kjs/property_map.cpp:
1055 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1057 2004-08-17 Darin Adler <darin@apple.com>
1061 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1063 * kjs/property_map.h: Added some private functions.
1064 * kjs/property_map.cpp:
1065 (KJS::PropertyMap::clear): Set sentinelCount to 0.
1066 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1067 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1068 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1069 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1070 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1071 deleted-element sentinels.
1072 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1074 2004-08-16 Maciej Stachowiak <mjs@apple.com>
1076 Code change by Eric Albert, reviewd by me.
1078 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1080 * kjs/date_object.cpp:
1081 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1082 entirely would be even better, but is not required to fix this bug.
1086 2004-08-16 Richard Williamson <rjw@apple.com>
1088 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1090 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1094 * bindings/NP_jsobject.cpp:
1096 * bindings/jni/jni_jsobject.cpp:
1098 * bindings/objc/WebScriptObject.mm:
1099 (-[WebScriptObject evaluateWebScript:]):
1101 2004-08-15 Richard Williamson <rjw@apple.com>
1103 More updates to np headers. Implemented new NPN functions.
1107 * bindings/NP_jsobject.cpp:
1111 * bindings/npruntime.h:
1113 2004-08-13 Darin Adler <darin@apple.com>
1115 - fix build so we can compile again
1117 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
1118 is good enough so that we can compile, but it's only a stopgap measure, because I think
1119 Richard has a newer one he wants to check in.
1121 2004-08-12 Richard Williamson <rjw@apple.com>
1123 Bring npruntime.h and friends closer to compliance with
1128 * JavaScriptCore.pbproj/project.pbxproj:
1129 * bindings/NP_jsobject.cpp:
1131 (_NPN_CreateScriptObject):
1136 (NPN_RemoveProperty):
1137 * bindings/NP_jsobject.h:
1138 * bindings/c/c_instance.cpp:
1139 (CInstance::invokeMethod):
1140 * bindings/c/c_utility.cpp:
1141 (convertNPVariantToValue):
1142 * bindings/npruntime.cpp:
1143 (NPN_IdentifierIsString):
1144 (NPN_VariantIsVoid):
1145 (NPN_VariantIsNull):
1146 (NPN_VariantIsUndefined):
1147 (NPN_VariantIsBool):
1148 (NPN_VariantIsInt32):
1149 (NPN_VariantIsDouble):
1150 (NPN_VariantIsString):
1151 (NPN_VariantIsObject):
1152 (NPN_VariantToBool):
1153 (NPN_VariantToString):
1154 (NPN_VariantToInt32):
1155 (NPN_VariantToDouble):
1156 (NPN_VariantToObject):
1157 (NPN_InitializeVariantAsVoid):
1158 (NPN_InitializeVariantAsNull):
1159 (NPN_InitializeVariantAsUndefined):
1160 (NPN_InitializeVariantWithBool):
1161 (NPN_InitializeVariantWithInt32):
1162 (NPN_InitializeVariantWithDouble):
1163 (NPN_InitializeVariantWithString):
1164 (NPN_InitializeVariantWithStringCopy):
1165 (NPN_InitializeVariantWithObject):
1166 (NPN_InitializeVariantWithVariant):
1167 (NPN_ReleaseVariantValue):
1169 * bindings/npruntime.h:
1171 (_NPString::_NPVariant::):
1172 * bindings/npruntime_priv.h: Added.
1174 2004-08-12 Darin Adler <darin@apple.com>
1178 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
1181 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
1182 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
1183 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
1184 to skip leading "+" or "-".
1188 2004-08-12 Darin Adler <darin@apple.com>
1192 - fixed 43 Mozilla JavaScript tests
1194 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
1195 * kjs/date_object.cpp:
1196 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
1197 than constructing a number object to pass to it.
1198 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
1199 (KJS::parseDate): Change to return a double instead of creating the Number object here.
1200 (KJS::timeClip): Implement this as specified in the language standard.
1202 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
1203 flags on the prototype property.
1206 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
1208 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
1210 (KJS::parseDigit): Added. Helper function for parseInt.
1211 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
1212 strtoll can handle. Also matches standard more closely.
1213 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
1215 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
1217 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
1219 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
1221 (Lexer::setCode): Clear error state.
1222 (Lexer::lex): Set error state if the lexer encounters an error
1225 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
1226 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
1228 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
1229 Change round to round values between -0.5 and -0 to -0 instead of +0.
1231 * kjs/nodes.h: Add evaluateReference function to GroupNode.
1232 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
1233 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
1234 would change x.y into a value that can't be deleted as a side effect.
1236 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
1239 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
1240 get rid of the fixed size limit for code.
1242 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
1243 returns the string without creating a new Rep, since I'm using substr in a place where it will
1244 often be passed a 0.
1246 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
1247 the other day that was making a couple tests fail.
1248 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1249 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1250 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1251 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1252 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1254 * kjs/string_object.lut.h: Regenerated.
1256 2004-08-11 Darin Adler <darin@apple.com>
1258 - fixed a tiny problem with the UTF-16 PCRE check-in
1260 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
1261 the ctype_meta flag to get set in items that should not have it.
1263 * pcre/chartables.c: Regenerated.
1265 2004-08-10 Richard Williamson <rjw@apple.com>
1267 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
1269 The following WebScripting methods are now supported on bound
1272 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
1273 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
1274 - (id)valueForUndefinedKey:(NSString *)key
1278 * bindings/c/c_class.cpp:
1279 (CClass::fieldNamed):
1280 * bindings/c/c_class.h:
1281 * bindings/jni/jni_class.cpp:
1282 (JavaClass::fieldNamed):
1283 * bindings/jni/jni_class.h:
1284 * bindings/objc/objc_class.h:
1285 (KJS::Bindings::ObjcClass::isa):
1286 * bindings/objc/objc_class.mm:
1287 (ObjcClass::methodsNamed):
1288 (ObjcClass::fieldNamed):
1289 (ObjcClass::fallbackObject):
1290 * bindings/objc/objc_instance.h:
1291 * bindings/objc/objc_instance.mm:
1292 (ObjcInstance::invokeMethod):
1293 (ObjcInstance::setValueOfField):
1294 (ObjcInstance::setValueOfUndefinedField):
1295 (ObjcInstance::getValueOfField):
1296 (ObjcInstance::getValueOfUndefinedField):
1297 * bindings/objc/objc_runtime.h:
1298 (KJS::Bindings::ObjcField::~ObjcField):
1299 (KJS::Bindings::ObjcField::ObjcField):
1300 (KJS::Bindings::ObjcField::operator=):
1301 (KJS::Bindings::FallbackObjectImp::classInfo):
1302 * bindings/objc/objc_runtime.mm:
1303 (ObjcField::ObjcField):
1306 (ObjcField::valueFromInstance):
1307 (ObjcField::setValueToInstance):
1308 (FallbackObjectImp::FallbackObjectImp):
1309 (FallbackObjectImp::get):
1310 (FallbackObjectImp::put):
1311 (FallbackObjectImp::canPut):
1312 (FallbackObjectImp::implementsCall):
1313 (FallbackObjectImp::call):
1314 (FallbackObjectImp::hasProperty):
1315 (FallbackObjectImp::deleteProperty):
1316 (FallbackObjectImp::defaultValue):
1317 * bindings/runtime.h:
1318 (KJS::Bindings::Class::fallbackObject):
1319 (KJS::Bindings::Instance::getValueOfUndefinedField):
1320 (KJS::Bindings::Instance::setValueOfUndefinedField):
1321 * bindings/runtime_object.cpp:
1322 (RuntimeObjectImp::get):
1323 (RuntimeObjectImp::put):
1324 (RuntimeObjectImp::canPut):
1325 (RuntimeObjectImp::hasProperty):
1326 * bindings/testbindings.mm:
1327 (-[MyFirstInterface valueForUndefinedKey:]):
1328 (-[MyFirstInterface setValue:forUndefinedKey:]):
1330 2004-08-10 Darin Adler <darin@apple.com>
1334 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
1336 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
1337 or uint16_t depending on the mode, and used appropriate in the 7 public functions
1338 that need to use it.
1339 * pcre/pcre.c: Add UTF-16 support to all functions.
1340 * pcre/study.c: Ditto.
1342 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
1343 the mode. Changed declarations to use symbolic constants and typedefs so we size
1344 things to ichar when needed.
1346 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
1347 sized to 16-bit characters instead of 8-bit.
1350 (pcre_copy_substring): Use pcre_char instead of char.
1351 (pcre_get_substring_list): Ditto.
1352 (pcre_free_substring_list): Ditto.
1353 (pcre_get_substring): Ditto.
1354 (pcre_free_substring): Ditto.
1356 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
1357 of hard-coding 8-bit table sizes.
1359 * pcre/chartables.c: Regenerated.
1361 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
1362 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
1363 is not null. The null string still has a null pointer. This prevents us from
1364 passing a null through to the regular expression engine (which results in a null
1365 error even when the string length is 0).
1368 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
1369 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
1371 2004-08-09 Darin Adler <darin@apple.com>
1375 - fixed 28 Mozilla JavaScript tests
1377 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
1378 checking the number of arguments for the join method.
1380 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
1381 than integers, so we aren't limited to 32 bits.
1383 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
1384 the implementation of the pow operation. Also simplied a case that was handling positive
1385 and negative infinity separately.
1387 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
1388 putting them in a long, so that unsigned shift will work properly.
1390 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
1392 * kjs/operations.cpp:
1393 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
1394 sign of isinf; our isinf function returns +1 even for negative infinity.
1395 (KJS::isNegInf): And again.
1396 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
1397 Our floating point already handles the various infinity cases correctly.
1399 * kjs/regexp_object.cpp:
1400 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
1401 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
1402 array in cases where we did not match.
1403 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
1404 "global", "ignoreCase", "multiline", and "source".
1406 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
1407 string into undefined rather than an empty string. For the slice method, handle an
1408 undefined parameter for the limit properly as decribed in the specification, and add
1409 the limit to one case that didn't have the limit at all. For the methods that generate
1410 HTML strings, use lowercase tags instead of uppercase.
1413 (KJS::UChar::toLower): Use u_tolower from the ICU library.
1414 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
1415 (KJS::UString::append): Fix some math that caused a buffer overflow.
1416 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
1417 flag) rather than converting them all to 0.
1418 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
1420 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
1422 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
1423 the Unicode specification in a few cases where it was wrong before.
1424 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
1425 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
1426 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
1427 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
1428 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1429 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1430 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1431 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1432 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1434 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
1436 * kjs/number_object.lut.h: Regenerated.
1438 2004-08-09 Darin Adler <darin@apple.com>
1442 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
1444 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
1445 we get a buffer overflow.
1449 2004-08-05 Richard Williamson <rjw@apple.com>
1451 Fixed part of 3674747. The QT guys need this for feature freeze.
1453 This patch implements support for the
1455 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
1457 method of objects bound to JavaScript.
1462 * bindings/objc/objc_class.mm:
1463 (ObjcClass::methodsNamed):
1464 (ObjcClass::fieldNamed):
1465 * bindings/objc/objc_instance.mm:
1466 (ObjcInstance::invokeMethod):
1467 * bindings/objc/objc_runtime.h:
1468 (KJS::Bindings::ObjcMethod::~ObjcMethod):
1469 (KJS::Bindings::ObjcMethod::isFallbackMethod):
1470 (KJS::Bindings::ObjcMethod::javaScriptName):
1471 * bindings/objc/objc_runtime.mm:
1472 (ObjcMethod::ObjcMethod):
1473 (ObjcMethod::getMethodSignature):
1474 (ObjcMethod::setJavaScriptName):
1475 * bindings/testbindings.mm:
1477 2004-08-04 Vicki Murley <vicki@apple.com>
1481 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
1484 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1485 go to the next line and continue parsing the string (instead of failing). This matches
1486 behavior in Mac IE and Mozilla.
1488 2004-08-03 Kevin Decker <kdecker@apple.com>
1492 Rolled in changes from the latest KJS sources that support additional
1493 Number.prototype functions.
1495 Specifically this patch covers the follow parts of the ECMA 3 spec:
1496 15.7.4.5, 15.7.4.6, and 15.7.4.7
1499 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1500 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1501 <rdar://problem/3749591> missing Number.toExponential prototype implementation
1503 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1504 list of supported identifiers (a macro).
1505 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1506 and toExponential().
1507 (NumberPrototypeImp::NumberPrototypeImp):
1508 (NumberProtoFuncImp::call):
1509 * kjs/number_object.h: Added property names for toFixed, toPrecision,
1511 (KJS::NumberProtoFuncImp::):
1512 * tests/mozilla/expected.html: Update results.
1514 2004-08-03 Darin Adler <darin@apple.com>
1518 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1520 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1521 we are supposed to just copy the regular expression object, and do so.
1522 Also tighten up arguments check to handle case where an actual "undefined"
1523 is passed rather than just omitting an argument.
1525 * tests/mozilla/expected.html: Update results.
1527 2004-08-02 Darin Adler <darin@apple.com>
1529 * tests/mozilla/.cvsignore: Added.
1530 * tests/mozilla/expected.html: Update results.
1532 2004-08-02 Darin Adler <darin@apple.com>
1536 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1538 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1539 Append the flags here so more tests paseed.
1541 2004-08-02 Darin Adler <darin@apple.com>
1545 - fixed a couple things making 5 Mozilla regexp tests pass
1547 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1549 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1550 be used as the flags string when no parameter was passed.
1552 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1553 Added a class info object for RegExp prototype so it can return
1554 a string instead of raising an exception when converting to a string.
1556 * tests/mozilla/expected.html: Update results.
1558 2004-08-02 Darin Adler <darin@apple.com>
1562 - fix crashes in mozilla tests due to mishandling NaN
1564 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1565 calls to toInteger so that NaN will get turned into something that fits in an integer.
1566 These were the ones John already fixed, but his fix used isnan and the new fix is
1569 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1570 after a call to toInteger to handle NaN properly. Also removed separate check
1571 for undefined that's not needed.
1573 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1574 as in the above two files, but for a lot more functions. Also changed one place with
1575 an explicit check for undefined to instead just check isNaN.
1577 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1578 like me who don't keep $SYMROOTS in their $PATH.
1584 2004-07-26 Kevin Decker <kdecker@apple.com>
1586 Changes done by Darin, reviewed by Kevin.
1588 - changed testkjs to build in Xcode rather than from Makefile
1590 * .cvsignore: Removed obsolete files from this list.
1591 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1592 Changed to build target "All" rather than default target. This makes us
1593 build the testkjs test tool.
1594 * dummy.cpp: Removed.
1595 * kjs/.cvsignore: Removed obsolete files from this list, including
1596 the testkjs tool, which is now built in the symroots directory.
1597 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1598 changed this file. Also this has the nice side effect of causing the tool
1599 to be rebuilt in the new location even if there are no other changes in
1600 your tree when you check this out.
1601 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1602 without setting the execute bit on jsDriver.pl.
1604 2004-07-22 Kevin Decker <kdecker@apple.com>
1608 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
1610 * kjs/function_object.cpp:
1611 (FunctionObjectImp::construct):
1612 * kjs/function_object.h:
1614 (KJS::ObjectImp::construct):
1616 (KJS::Object::construct):
1618 2004-07-21 Darin Adler <darin@apple.com>
1620 * bindings/npruntime.h: Fixed typo.
1622 2004-07-19 John Sullivan <sullivan@apple.com>
1626 - bulletproofed array.slice() against NAN arguments. Harri noticed this
1627 vulnerability in my patch for 3714644
1629 * kjs/array_object.cpp:
1630 (ArrayProtoFuncImp::call):
1631 handle NAN parameters passed to slice() by clamping to 0 and length.
1633 2004-07-19 Richard Williamson <rjw@apple.com>
1635 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
1640 * bindings/jni/jni_jsobject.cpp:
1642 (JSObject::JSObject):
1644 2004-07-16 John Sullivan <sullivan@apple.com>
1648 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
1649 hangs browser with javascript
1651 * kjs/array_object.cpp:
1652 (ArrayProtoFuncImp::call):
1653 Check for undefined type for args[0] the same way we were already checking
1654 for args[1]. In this case, args was zero-length, but we were treating
1655 args[0] like an integer anyway. Resulted in some code looping from a NAN
1656 value to 4, taking approximately forever.
1658 * JavaScriptCore.pbproj/project.pbxproj:
1663 2004-07-14 Maciej Stachowiak <mjs@apple.com>
1667 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1668 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1670 * kjs/number_object.cpp:
1671 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1673 2004-07-13 Kevin Decker <kdecker@apple.com>
1675 Reviewed by kocienda.
1677 - made testkjs and JavaScriptCore a subtarget of 'All'
1678 - testkjs now builds in $SYMROOTS
1680 * JavaScriptCore.pbproj/project.pbxproj:
1684 2004-06-24 Chris Blumenberg <cblu@apple.com>
1686 Ignore .mode1 files in JavaScriptCore.pbproj
1688 Reviewed by kocienda.
1690 * JavaScriptCore.pbproj/.cvsignore:
1692 2004-06-23 Richard Williamson <rjw@apple.com>
1694 Implemented changes for latest npruntime.h.
1698 * JavaScriptCore.pbproj/project.pbxproj:
1699 * bindings/NP_jsobject.cpp:
1700 (listFromVariantArgs):
1701 (identiferFromNPIdentifier):
1702 (_NPN_CreateScriptObject):
1707 (NPN_RemoveProperty):
1708 * bindings/NP_jsobject.h:
1709 * bindings/c/c_class.cpp:
1710 (CClass::methodsNamed):
1711 (CClass::fieldNamed):
1712 * bindings/c/c_instance.cpp:
1713 (CInstance::invokeMethod):
1714 * bindings/c/c_utility.cpp:
1715 (convertNPVariantToValue):
1716 * bindings/c/c_utility.h:
1717 * bindings/npruntime.cpp:
1718 (stringIdentifierEqual):
1719 (stringIdentifierHash):
1720 (getStringIdentifierDictionary):
1721 (intIdentifierEqual):
1722 (intIdentifierHash):
1723 (getIntIdentifierDictionary):
1724 (NPN_GetStringIdentifier):
1725 (NPN_GetStringIdentifiers):
1726 (NPN_GetIntIdentifier):
1727 (NPN_IdentifierIsString):
1728 (NPN_UTF8FromIdentifier):
1729 (NPN_VariantToInt32):
1730 (NPN_VariantToDouble):
1732 * bindings/npruntime.h:
1733 * bindings/objc/WebScriptObject.mm:
1734 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1735 * bindings/runtime_object.cpp:
1736 (RuntimeObjectImp::~RuntimeObjectImp):
1737 * bindings/runtime_root.cpp:
1738 (KJS::Bindings::rootForInterpreter):
1739 * bindings/testbindings.cpp:
1740 (initializeIdentifiers):
1746 === JavaScriptCore-146.1 ===
1748 2004-06-16 Richard Williamson <rjw@apple.com>
1750 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1752 This turned out to be a show stopper for Dashboard. Accessing a nil
1753 ObjC property from JS caused a crash. Similar to the problem
1754 3696112 fixed below.
1758 * bindings/objc/objc_runtime.mm:
1759 (KJS::Bindings::ObjcField::valueFromInstance):
1763 2004-06-16 Richard Williamson <rjw@apple.com>
1765 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1767 This turned out to be a show stopper for Dashboard. We now
1768 return Undefined() when nil is returned from a ObjC method
1769 that returns an object type.
1773 * bindings/objc/objc_utility.mm:
1774 (KJS::Bindings::convertObjcValueToValue):
1778 2004-06-15 Richard Williamson <rjw@apple.com>
1780 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1782 No longer need to check respondsToSelector: for
1783 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1784 because these now have a default implementation on NSObject.
1788 * bindings/objc/objc_class.mm:
1789 (ObjcClass::methodsNamed):
1790 (ObjcClass::fieldNamed):
1792 2004-06-14 Darin Adler <darin@apple.com>
1796 - fixed some things for GC that Patrick missed, or that happened after the branch
1798 * bindings/objc/WebScriptObject.mm:
1799 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1800 (-[WebScriptObject finalize]): Added.
1802 - added some missing nil checks
1804 * bindings/objc/objc_instance.mm:
1805 (ObjcInstance::ObjcInstance): Check for nil.
1806 (ObjcInstance::~ObjcInstance): Check for nil.
1807 (ObjcInstance::operator=): Check for nil.
1809 2004-06-14 Darin Adler <darin@apple.com>
1811 Reviewed by me, code changes by Patrick Beard.
1813 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1815 * bindings/objc/objc_instance.mm:
1816 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1817 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1818 (ObjcInstance::operator=): More of the same.
1819 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1821 * bindings/objc/objc_runtime.mm:
1822 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1823 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1824 (ObjcArray::operator=): More of the same.
1826 * bindings/testbindings.mm: Fixed incorrect license.
1827 (main): Use [pool drain] if compiling on Tiger.
1831 2004-06-10 Kevin Decker <kdecker@apple.com>
1837 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1839 (KJS::Lexer::lineNo):
1840 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1842 === JavaScriptCore-143.2 ===
1844 2004-06-07 Darin Adler <darin@apple.com>
1846 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1848 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1849 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1851 === JavaScriptCore-143.1 ===
1853 2004-06-04 Kevin Decker <kdecker@apple.com>
1857 - fixed <rdar://problem/3680594>
1860 (KJS::Error::create):
1864 2004-06-04 Darin Adler <darin@apple.com>
1866 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1868 2004-06-04 Kevin Decker <kdecker@apple.com>
1872 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1873 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1874 - changed the wording of an error message
1875 - the lexer, parser, and interpreter have been made "sourceURL aware"
1876 - stored the url into Error
1878 * bindings/NP_jsobject.cpp:
1880 * bindings/jni/jni_jsobject.cpp:
1882 * bindings/objc/WebScriptObject.mm:
1883 (-[WebScriptObject evaluateWebScript:]):
1885 (GlobalFuncImp::call):
1886 * kjs/function_object.cpp:
1887 (FunctionObjectImp::construct):
1890 (InterpreterImp::checkSyntax):
1891 (InterpreterImp::evaluate):
1893 * kjs/interpreter.cpp:
1894 (Interpreter::evaluate):
1895 * kjs/interpreter.h:
1899 (KJS::Lexer::sourceURL):
1903 (FunctionCallNode::evaluate):
1906 (KJS::Error::create):
1909 2004-06-04 Richard Williamson <rjw@apple.com>
1911 Fixed crash when attempting to access properties on nil
1916 * bindings/objc/objc_instance.mm:
1917 (ObjcInstance::getClass):
1918 * bindings/runtime_object.cpp:
1919 (RuntimeObjectImp::get):
1920 * bindings/testM.js:
1921 * bindings/testbindings.mm:
1922 (-[MyFirstInterface getString]):
1924 2004-05-27 Kevin Decker <kdecker@apple.com>
1928 -revised generated error message content
1930 * kjs/error_object.cpp:
1931 (ErrorProtoFuncImp::call):
1935 (KJS::Error::create):
1939 2004-05-27 Richard Williamson <rjw@apple.com>
1941 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1945 * bindings/objc/WebScriptObject.h:
1947 2004-05-27 Darin Adler <darin@apple.com>
1951 - moved to new symlink technique for embedding frameworks
1953 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1954 because we don't need it any more.
1956 2004-05-24 Richard Williamson <rjw@apple.com>
1958 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1959 fixed ClassInfo to correctly reflect inheritance. This is required
1960 because of the runtime checks in JSC for arrays, i.e. in
1961 the Function objects apply method.
1965 * bindings/jni/jni_runtime.cpp:
1966 (JavaArray::convertJObjectToArray):
1967 * bindings/objc/objc_utility.mm:
1968 (KJS::Bindings::convertObjcValueToValue):
1969 * bindings/runtime_array.cpp:
1970 (RuntimeArrayImp::RuntimeArrayImp):
1971 * bindings/runtime_array.h:
1972 * bindings/testM.js: Added.
1973 * bindings/testbindings.mm:
1974 (+[MyFirstInterface webScriptNameForSelector:]):
1975 (-[MyFirstInterface logMessages:]):
1976 (-[MyFirstInterface logMessage:prefix:]):
1977 (-[MyFirstInterface callJSObject::]):
1979 2004-05-22 Darin Adler <darin@apple.com>
1983 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1985 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1986 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1987 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1988 it hasn't been set explicitly.
1992 2004-05-20 Richard Williamson <rjw@apple.com>
1994 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1995 can now be referenced like any other WebScriptObject, meaning
1996 you can do JS operations on them.
1998 All added implementation of finalizeForWebScript.
2002 * bindings/objc/WebScriptObject.h:
2003 * bindings/objc/WebScriptObject.mm:
2004 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
2005 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2006 (-[WebScriptObject KJS::]):
2007 (-[WebScriptObject dealloc]):
2008 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2009 (-[WebScriptObject evaluateWebScript:]):
2010 (-[WebScriptObject setValue:forKey:]):
2011 (-[WebScriptObject valueForKey:]):
2012 (-[WebScriptObject stringRepresentation]):
2013 * bindings/objc/WebScriptObjectPrivate.h:
2014 * bindings/objc/objc_instance.mm:
2015 (ObjcInstance::~ObjcInstance):
2017 2004-05-19 Richard Williamson <rjw@apple.com>
2019 Removed extraneous tabs that were added (by XCode?).
2021 * bindings/objc/WebScriptObject.h:
2023 2004-05-19 Darin Adler <darin@apple.com>
2025 - fixed headers with licenses mangled by Xcode auto-indenting
2027 * bindings/jni/jni_jsobject.cpp:
2028 * bindings/jni/jni_jsobject.h:
2029 * bindings/runtime_array.h:
2030 * bindings/runtime_root.cpp:
2031 * bindings/runtime_root.h:
2033 2004-05-18 Richard Williamson <rjw@apple.com>
2035 Added exception logging. Also check for exception and
2036 set results as appropriate.
2038 Reviewed by Maciej (partially reviewed).
2040 * bindings/objc/WebScriptObject.mm:
2041 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2042 (-[WebScriptObject evaluateWebScript:]):
2043 (-[WebScriptObject setValue:forKey:]):
2044 (-[WebScriptObject valueForKey:]):
2046 2004-05-18 Richard Williamson <rjw@apple.com>
2048 Finsished implementing support for windowScriptObject.
2049 Had to make WebScriptObjectPrivate.h accessible from
2054 * JavaScriptCore.pbproj/project.pbxproj:
2055 * bindings/objc/WebScriptObjectPrivate.h:
2057 2004-05-18 Richard Williamson <rjw@apple.com>
2059 Use KVC to set/get values instead of directly accessing
2064 * bindings/objc/WebScriptObject.mm:
2065 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2066 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2067 * bindings/objc/objc_runtime.mm:
2068 (ObjcField::valueFromInstance):
2069 (convertValueToObjcObject):
2070 (ObjcField::setValueToInstance):
2072 2004-05-17 Richard Williamson <rjw@apple.com>
2074 Implemented new API for WebScriptObject.
2076 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2077 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
2081 * JavaScriptCore.pbproj/project.pbxproj:
2082 * bindings/c/c_instance.cpp:
2083 (CInstance::invokeMethod):
2084 * bindings/jni/jni_instance.cpp:
2085 (JavaInstance::invokeMethod):
2086 * bindings/jni/jni_jsobject.cpp:
2087 (JSObject::convertValueToJObject):
2088 * bindings/jni/jni_utility.cpp:
2089 (KJS::Bindings::getJNIField):
2090 * bindings/objc/WebScriptObject.mm:
2092 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2093 (-[WebScriptObject KJS::]):
2094 (-[WebScriptObject dealloc]):
2095 (+[WebScriptObject throwException:]):
2097 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2098 (-[WebScriptObject evaluateWebScript:]):
2099 (-[WebScriptObject setValue:forKey:]):
2100 (-[WebScriptObject valueForKey:]):
2101 (-[WebScriptObject stringRepresentation]):
2102 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2103 (+[WebUndefined undefined]):
2104 (-[WebUndefined initWithCoder:]):
2105 (-[WebUndefined encodeWithCoder:]):
2106 (-[WebUndefined copyWithZone:]):
2107 (-[WebUndefined retain]):
2108 (-[WebUndefined release]):
2109 (-[WebUndefined retainCount]):
2110 (-[WebUndefined autorelease]):
2111 (-[WebUndefined dealloc]):
2112 (-[WebUndefined copy]):
2113 (-[WebUndefined replacementObjectForPortCoder:]):
2114 * bindings/objc/WebScriptObjectPrivate.h: Added.
2115 * bindings/objc/objc_class.mm:
2116 (ObjcClass::methodsNamed):
2117 (ObjcClass::fieldNamed):
2118 * bindings/objc/objc_instance.mm:
2119 (ObjcInstance::invokeMethod):
2120 * bindings/objc/objc_jsobject.h:
2121 * bindings/objc/objc_jsobject.mm:
2122 * bindings/objc/objc_runtime.mm:
2123 (ObjcField::valueFromInstance):
2124 * bindings/objc/objc_utility.mm:
2125 (KJS::Bindings::JSMethodNameToObjCMethodName):
2126 (KJS::Bindings::convertValueToObjcValue):
2127 (KJS::Bindings::convertObjcValueToValue):
2128 * bindings/runtime.cpp:
2129 (Instance::setDidExecuteFunction):
2130 (Instance::didExecuteFunction):
2131 (Instance::setValueOfField):
2132 * bindings/runtime.h:
2133 * bindings/testbindings.mm:
2134 (+[MyFirstInterface webScriptNameForSelector:]):
2135 (-[MyFirstInterface callJSObject::]):
2137 2004-05-14 Vicki Murley <vicki@apple.com>
2141 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
2143 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
2147 2004-05-13 Richard Williamson <rjw@apple.com>
2154 * bindings/objc/WebScriptObject.h:
2156 2004-05-13 Richard Williamson <rjw@apple.com>
2158 Approved API changes. Currently unimplemented.
2163 * JavaScriptCore.pbproj/project.pbxproj:
2164 * bindings/objc/WebScriptObject.h: Added.
2165 * bindings/objc/WebScriptObject.mm: Added.
2166 (+[WebScriptObject throwException:]):
2167 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2168 (-[WebScriptObject evaluateWebScript:]):
2169 (-[WebScriptObject stringRepresentation]):
2170 (+[WebUndefined undefined]):
2171 (-[WebUndefined initWithCoder:]):
2172 (-[WebUndefined encodeWithCoder:]):
2173 (-[WebUndefined copyWithZone:]):
2175 2004-05-07 Vicki Murley <vicki@apple.com>
2179 Turn off GC since it uses ppc only instructions (which breaks
2182 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
2186 2004-05-07 Maciej Stachowiak <mjs@apple.com>
2190 - add -funroll-loops=16 compiler option for approx .5% speedup on
2191 HTML iBench and .5-1% speedup on JS iBench.
2193 * JavaScriptCore.pbproj/project.pbxproj:
2195 2004-04-25 Maciej Stachowiak <mjs@apple.com>
2199 Enable full conservative GC mode in addition to test mode. When
2200 conservative GC is enabled, we now get an 11% speed improvement on
2201 the iBench. Also fix some spots I missed before.
2203 Specific noteworth changes:
2205 * kjs/collector.cpp:
2206 (KJS::Collector::markStackObjectsConservatively): Check possible
2207 cell pointers for 8-byte aligment and verify they are not 0.
2209 * kjs/protected_values.cpp:
2210 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
2211 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
2213 (KJS::gcProtectNullTolerant): ...to here...
2214 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
2215 tolerance, and doing the check is expensive.
2217 * kjs/protected_values.cpp:
2218 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
2219 that is still very good.
2224 (KJS::ProtectedValue::ProtectedValue):
2225 (KJS::ProtectedValue::~ProtectedValue):
2226 (KJS::ProtectedValue::operator=):
2227 (KJS::ProtectedObject::ProtectedObject):
2228 (KJS::ProtectedObject::~ProtectedObject):
2229 (KJS::ProtectedObject::operator=):
2230 (KJS::ProtectedReference::ProtectedReference):
2231 (KJS::ProtectedReference::~ProtectedReference):
2232 (KJS::ProtectedReference::operator=):
2233 * kjs/protected_values.cpp:
2234 (KJS::ProtectedValues::getProtectCount):
2235 (KJS::ProtectedValues::increaseProtectCount):
2236 (KJS::ProtectedValues::decreaseProtectCount):
2237 (KJS::ProtectedValues::computeHash):
2238 * bindings/runtime_root.cpp:
2239 (KJS::Bindings::addNativeReference):
2240 (KJS::Bindings::removeNativeReference):
2241 (RootObject::removeAllNativeReferences):
2242 * bindings/runtime_root.h:
2243 (KJS::Bindings::RootObject::~RootObject):
2244 (KJS::Bindings::RootObject::setRootObjectImp):
2245 * kjs/collector.cpp:
2246 (KJS::Collector::allocate):
2247 (KJS::Collector::collect):
2250 (NumberImp::create):
2251 (InterpreterImp::globalInit):
2252 (InterpreterImp::globalClear):
2253 (InterpreterImp::mark):
2255 (KJS::List::derefValues):
2256 (KJS::List::refValues):
2257 (KJS::List::append):
2259 (KJS::ObjectImp::setInternalValue):
2260 (KJS::ObjectImp::putDirect):
2265 (KJS::ValueImp::ValueImp):
2266 (KJS::ValueImp::~ValueImp):
2268 (KJS::Value::Value):
2269 (KJS::Value::~Value):
2270 (KJS::Value::operator=):
2272 2004-04-30 Richard Williamson <rjw@apple.com>
2274 Asking an NSInvocation for it's return value when return type
2275 is void throws an exception. Added check for void return types
2276 to avoid this exception.
2280 * bindings/objc/objc_instance.mm:
2281 (ObjcInstance::invokeMethod):
2283 2004-04-29 Richard Williamson <rjw@apple.com>
2285 Fixed several bad problems with the ObjC bindings. In particular, conversion
2286 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
2290 * bindings/objc/objc_jsobject.h:
2291 * bindings/objc/objc_jsobject.mm:
2292 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2293 (-[JavaScriptObject KJS::]):
2294 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2295 (-[JavaScriptObject call:arguments:]):
2296 (-[JavaScriptObject evaluate:]):
2297 (-[JavaScriptObject getMember:]):
2298 (-[JavaScriptObject getSlot:]):
2299 * bindings/objc/objc_runtime.mm:
2300 (ObjcField::valueFromInstance):
2301 (ObjcField::setValueToInstance):
2302 * bindings/objc/objc_utility.mm:
2303 (KJS::Bindings::convertValueToObjcValue):
2304 (KJS::Bindings::convertObjcValueToValue):
2305 * bindings/runtime.h:
2306 * bindings/runtime_root.cpp:
2307 (KJS::Bindings::rootForInterpreter):
2308 (KJS::Bindings::addNativeReference):
2309 (KJS::Bindings::removeNativeReference):
2310 * bindings/runtime_root.h:
2311 * bindings/testbindings.mm:
2312 (-[MyFirstInterface logMessage:]):
2313 (-[MyFirstInterface setJSObject:]):
2314 (-[MyFirstInterface callJSObject::]):
2316 2004-04-24 Darin Adler <darin@apple.com>
2320 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
2323 2004-04-23 Maciej Stachowiak <mjs@apple.com>
2327 Implementation of conservative GC, based partly on code from
2328 Darin. It's turned off for now, so it shouldn't have any effect on
2331 * JavaScriptCore.pbproj/project.pbxproj:
2332 * kjs/collector.cpp:
2333 (KJS::Collector::markStackObjectsConservatively):
2334 (KJS::Collector::markProtectedObjects):
2335 (KJS::Collector::collect):
2340 * kjs/protected_values.cpp: Added.
2341 (KJS::ProtectedValues::getProtectCount):
2342 (KJS::ProtectedValues::increaseProtectCount):
2343 (KJS::ProtectedValues::insert):
2344 (KJS::ProtectedValues::decreaseProtectCount):
2345 (KJS::ProtectedValues::expand):
2346 (KJS::ProtectedValues::shrink):
2347 (KJS::ProtectedValues::rehash):
2348 (KJS::ProtectedValues::computeHash):
2349 * kjs/protected_values.h: Added.
2351 (ValueImp::useConservativeMark):
2359 2004-04-22 Richard Williamson <rjw@apple.com>
2361 Fixed build snafu (re-declaration of NPBool in npruntime.h and
2364 * bindings/npruntime.h:
2366 2004-04-22 Richard Williamson <rjw@apple.com>
2368 Updated plugin binding API to reflect latest revision from
2371 Biggest change is the introduction of NPVariant used to represent
2372 value types. NPVariant replaces the use of NPObject for the
2373 exchange of values between scripting environment and native code.
2377 * JavaScriptCore.pbproj/project.pbxproj:
2378 * bindings/NP_jsobject.cpp:
2379 (identiferFromNPIdentifier):
2385 (NPN_GetPropertyAtIndex):
2386 (NPN_SetPropertyAtIndex):
2387 * bindings/c/c_class.cpp:
2388 (CClass::methodsNamed):
2389 (CClass::fieldNamed):
2390 * bindings/c/c_instance.cpp:
2391 (CInstance::invokeMethod):
2392 (CInstance::defaultValue):
2393 * bindings/c/c_runtime.cpp:
2394 (CField::valueFromInstance):
2395 (CField::setValueToInstance):
2396 * bindings/c/c_utility.cpp:
2397 (convertNPStringToUTF16):
2398 (convertUTF8ToUTF16):
2399 (coerceValueToNPVariantStringType):
2400 (convertValueToNPVariant):
2401 (convertNPVariantToValue):
2402 * bindings/c/c_utility.h:
2403 * bindings/npruntime.cpp:
2404 (NPN_GetIdentifier):
2405 (NPN_GetIdentifiers):
2406 (NPN_UTF8FromIdentifier):
2407 (NPN_VariantIsVoid):
2408 (NPN_VariantIsNull):
2409 (NPN_VariantIsUndefined):
2410 (NPN_VariantIsBool):
2411 (NPN_VariantIsInt32):
2412 (NPN_VariantIsDouble):
2413 (NPN_VariantIsString):
2414 (NPN_VariantIsObject):
2415 (NPN_VariantToBool):
2416 (NPN_VariantToString):
2417 (NPN_VariantToInt32):
2418 (NPN_VariantToDouble):
2419 (NPN_VariantToObject):
2420 (NPN_InitializeVariantAsVoid):
2421 (NPN_InitializeVariantAsNull):
2422 (NPN_InitializeVariantAsUndefined):
2423 (NPN_InitializeVariantWithBool):
2424 (NPN_InitializeVariantWithInt32):
2425 (NPN_InitializeVariantWithDouble):
2426 (NPN_InitializeVariantWithString):
2427 (NPN_InitializeVariantWithStringCopy):
2428 (NPN_InitializeVariantWithObject):
2429 (NPN_InitializeVariantWithVariant):
2430 (NPN_ReleaseVariantValue):
2433 (NPN_ReleaseObject):
2434 (NPN_IsKindOfClass):
2435 (NPN_SetExceptionWithUTF8):
2437 * bindings/npruntime.h:
2439 (_NPString::_NPVariant::):
2440 * bindings/testbindings.cpp:
2455 2004-04-22 Darin Adler <darin@apple.com>
2459 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
2462 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
2463 Was resulting in a buffer 2x the needed size.
2464 (KJS::UString::expandPreCapacity): Ditto.
2465 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2467 2004-04-21 Maciej Stachowiak <mjs@apple.com>
2471 Preliminary change for conservative GC. Create "protected"
2472 subclasses to GC-protect objects when on heap, since we will soon
2473 remove the built-in refcounting of the normal wrapper classes. Use
2476 * JavaScriptCore.pbproj/project.pbxproj:
2479 (KJS::InterpreterImp::globalObject):
2480 * kjs/interpreter.h:
2481 * kjs/property_map.cpp:
2483 * kjs/reference_list.cpp:
2485 2004-04-19 Maciej Stachowiak <mjs@apple.com>
2489 Optimize prepend using the shared substring optimization. Also,
2490 limit the applicability of shared append and shared prepend. If
2491 you overdo it, it does more harm than good, because you create a
2492 bunch of strings that are disqualified from future shared
2493 append/prepend, for not much immediate savings in allocate/copy
2498 (KJS::UString::Rep::create):
2499 (KJS::UString::expandedSize):
2500 (KJS::UString::usedPreCapacity):
2501 (KJS::UString::expandCapacity):
2502 (KJS::UString::expandPreCapacity):
2503 (KJS::UString::UString):
2504 (KJS::UString::append):
2505 (KJS::UString::operator=):
2507 (KJS::UString::Rep::data):
2509 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2510 Reviewed by Richard.
2512 No more need for Completion or Reference to privately inherit from
2513 Value, none of the superclass functionality is used.
2520 2004-04-16 Richard Williamson <rjw@apple.com>
2522 Added interpreter lock protection around object creation.
2526 * bindings/runtime.cpp:
2527 (Instance::createRuntimeObject):
2529 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2533 Another JavaScript speed improvement: use the mechanism from
2534 string append optimization to make taking a substring fast, again
2537 A further 22% improvement on the 24fun string speed test.
2541 (KJS::UString::Rep::create):
2542 (KJS::UString::UString):
2543 (KJS::UString::append):
2544 (KJS::UString::operator=):
2545 (KJS::UString::substr):
2547 (KJS::UString::Rep::data):
2549 2004-04-13 Maciej Stachowiak <mjs@apple.com>
2553 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2554 - fixed <rdar://problem/3600691>: Table generation test is really slow
2555 - fixed <rdar://problem/3600661>: 24fun date test is really slow
2557 80% speedup on the string test, lesser speedups on the other two.
2559 Two different optimizations here:
2561 1) Avoid large overhead of scanning strings to see if they are all
2562 ASCII before numeric conversion.
2565 (AssignNode::evaluate): Don't convert to integer until we know for
2566 sure the operation will need it. Attempting to convert strings to
2567 numbers is a waste when they are being appended with +=.
2569 2) Avoid huge cost of appending strings.
2571 This is done by allowing multiple strings to share a buffer but
2572 actually use different ranges of it. The first time a string is
2573 appended to, we start leaving at least 10% extra space in the
2574 buffer, so doing N appends to the same string takes O(log N)
2575 mallocs instead of O(N).
2577 * kjs/identifier.cpp:
2578 (KJS::Identifier::equal):
2579 (KJS::Identifier::add):
2582 (KJS::UCharReference::operator=):
2583 (KJS::UCharReference::ref):
2584 (KJS::UString::Rep::create):
2585 (KJS::UString::Rep::destroy):
2586 (KJS::UString::expandedSize):
2587 (KJS::UString::usedCapacity):
2588 (KJS::UString::expandCapacity):
2589 (KJS::UString::UString):
2590 (KJS::UString::null):
2591 (KJS::UString::append):
2592 (KJS::UString::operator=):
2593 (KJS::UString::toStrictUInt32):
2594 (KJS::UString::detach):
2595 (KJS::KJS::operator==):
2597 (KJS::UString::Rep::data):
2598 (KJS::UString::Rep::hash):
2600 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2604 - fix deployment build by avoiding deployment-only warning.
2606 * kjs/scope_chain.cpp:
2607 (KJS::ScopeChain::bottom):
2609 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2613 Changed things so that newly created objects get a prototype based
2614 on the scope chain of the current function, rather than the
2615 interpreter that started execution. This fixes the following bugs:
2617 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2618 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2620 * JavaScriptCore.pbproj/project.pbxproj:
2621 * kjs/array_object.cpp:
2622 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2623 (ArrayProtoFuncImp::ArrayProtoFuncImp):
2624 (ArrayProtoFuncImp::call):
2625 (ArrayObjectImp::construct):
2626 * kjs/bool_object.cpp:
2627 (BooleanObjectImp::construct):
2628 * kjs/date_object.cpp:
2629 (DateProtoFuncImp::DateProtoFuncImp):
2630 (DateProtoFuncImp::call):
2631 (DateObjectImp::construct):
2632 * kjs/error_object.cpp:
2633 (ErrorObjectImp::construct):
2635 (FunctionImp::FunctionImp):
2636 (FunctionImp::call):
2637 (DeclaredFunctionImp::construct):
2638 (ArgumentsImp::ArgumentsImp):
2639 (GlobalFuncImp::call):
2640 * kjs/function_object.cpp:
2641 (FunctionProtoFuncImp::call):
2642 (FunctionObjectImp::construct):
2644 (BooleanImp::toObject):
2645 (StringImp::toObject):
2646 (NumberImp::toObject):
2647 (InterpreterImp::InterpreterImp):
2648 (InterpreterImp::clear):
2649 (InterpreterImp::interpreterWithGlobalObject):
2651 * kjs/interpreter.cpp:
2652 (ExecState::lexicalInterpreter):
2653 * kjs/interpreter.h:
2654 (KJS::ExecState::dynamicInterpreter):
2655 (KJS::ExecState::interpreter):
2656 * kjs/math_object.cpp:
2657 (MathFuncImp::MathFuncImp):
2659 (StatementNode::hitStatement):
2660 (StatementNode::abortStatement):
2661 (RegExpNode::evaluate):
2662 (ElementNode::evaluate):
2663 (ArrayNode::evaluate):
2664 (ObjectLiteralNode::evaluate):
2665 (PropertyValueNode::evaluate):
2666 (FunctionCallNode::evaluate):
2667 (FuncDeclNode::processFuncDecl):
2668 (FuncExprNode::evaluate):
2669 * kjs/number_object.cpp:
2670 (NumberObjectImp::construct):
2672 (KJS::ObjectImp::defaultValue):
2673 (KJS::Error::create):
2674 * kjs/object_object.cpp:
2675 (ObjectObjectImp::construct):
2676 * kjs/reference.cpp:
2677 (Reference::putValue):
2678 * kjs/regexp_object.cpp:
2679 (RegExpProtoFuncImp::call):
2680 (RegExpObjectImp::arrayOfMatches):
2681 (RegExpObjectImp::construct):
2682 * kjs/scope_chain.cpp:
2683 (KJS::ScopeChain::bottom):
2684 * kjs/scope_chain.h:
2685 * kjs/string_object.cpp:
2686 (StringProtoFuncImp::StringProtoFuncImp):
2687 (StringProtoFuncImp::call):
2688 (StringObjectImp::construct):
2694 2004-03-31 Richard Williamson <rjw@apple.com>
2696 Tedious renames based on feedback from plugin-futures list.
2697 NP_ functions are renamed with NPN_ prefix.
2698 Types prefix renamed from NP_ to NP.
2699 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2701 No review because this was just a renaming patch.
2703 * bindings/NP_jsobject.cpp:
2706 (identiferFromNPIdentifier):
2711 (NPN_RemoveProperty):
2713 (NPN_GetPropertyAtIndex):
2714 (NPN_SetPropertyAtIndex):
2715 * bindings/NP_jsobject.h:
2716 * bindings/c/c_class.cpp:
2717 (CClass::_commonInit):
2718 (CClass::classForIsA):
2720 (CClass::methodsNamed):
2721 (CClass::fieldNamed):
2722 * bindings/c/c_class.h:
2723 * bindings/c/c_instance.cpp:
2724 (CInstance::CInstance):
2725 (CInstance::~CInstance):
2726 (CInstance::operator=):
2727 (CInstance::invokeMethod):
2728 (CInstance::defaultValue):
2729 * bindings/c/c_instance.h:
2730 (KJS::Bindings::CInstance::getObject):
2731 * bindings/c/c_runtime.cpp:
2732 (CField::valueFromInstance):
2733 (CField::setValueToInstance):
2734 * bindings/c/c_runtime.h:
2735 (KJS::Bindings::CField::CField):
2736 (KJS::Bindings::CField::name):
2737 (KJS::Bindings::CMethod::CMethod):
2738 (KJS::Bindings::CMethod::name):
2739 * bindings/c/c_utility.cpp:
2740 (coerceValueToNPString):
2741 (convertValueToNPValueType):
2742 (convertNPValueTypeToValue):
2743 * bindings/c/c_utility.h:
2744 * bindings/npruntime.cpp:
2745 (NPN_IdentifierFromUTF8):
2746 (NPN_IsValidIdentifier):
2747 (NPN_GetIdentifiers):
2748 (NPN_UTF8FromIdentifier):
2751 (NPN_ReleaseObject):
2752 (NPN_IsKindOfClass):
2753 (NPN_SetExceptionWithUTF8):
2756 (NPN_CreateNumberWithInt):
2757 (NPN_CreateNumberWithFloat):
2758 (NPN_CreateNumberWithDouble):
2759 (NPN_IntFromNumber):
2760 (NPN_FloatFromNumber):
2761 (NPN_DoubleFromNumber):
2763 (NPN_CreateStringWithUTF8):
2764 (NPN_CreateStringWithUTF16):
2765 (NPN_DeallocateUTF8):
2766 (NPN_UTF8FromString):
2767 (NPN_UTF16FromString):
2770 (NPN_CreateBoolean):
2771 (NPN_BoolFromBoolean):
2774 (undefinedAllocate):
2780 (NPN_ObjectAtIndex):
2781 * bindings/npruntime.h:
2782 * bindings/runtime.cpp:
2783 (Instance::createBindingForLanguageInstance):
2784 * bindings/testbindings.cpp:
2785 (initializeIdentifiers):
2805 2004-03-31 Richard Williamson <rjw@apple.com>
2807 Changed references to NP_runtime.h to npruntime.h
2809 * JavaScriptCore.pbproj/project.pbxproj:
2810 * bindings/NP_jsobject.h:
2811 * bindings/c/c_class.h:
2812 * bindings/c/c_instance.h:
2813 * bindings/c/c_runtime.h:
2814 * bindings/c/c_utility.h:
2815 * bindings/npruntime.cpp:
2817 2004-03-31 Richard Williamson <rjw@apple.com>
2819 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2821 * JavaScriptCore.pbproj/project.pbxproj:
2822 * bindings/NP_jsobject.h:
2823 * bindings/npruntime.cpp:
2827 2004-03-23 Richard Williamson <rjw@apple.com>
2829 Added implementation of KJS::Value <-> NP_Object conversion functions.
2830 Augmented test program for 'C' bindings.
2831 Added asserts and parameter checking to all public API.
2835 * JavaScriptCore.pbproj/project.pbxproj:
2836 * bindings/NP_jsobject.cpp:
2838 * bindings/NP_jsobject.h: Added.
2839 * bindings/NP_runtime.cpp:
2840 (NP_IdentifierFromUTF8):
2841 (NP_IsValidIdentifier):
2842 (NP_GetIdentifiers):
2847 (NP_SetExceptionWithUTF8):
2850 (NP_FloatFromNumber):
2851 (NP_DoubleFromNumber):
2852 (NP_CreateStringWithUTF8):
2853 (NP_CreateStringWithUTF16):
2854 (NP_DeallocateUTF8):
2855 (NP_UTF8FromString):
2856 (NP_UTF16FromString):
2858 (NP_BoolFromBoolean):
2859 * bindings/NP_runtime.h:
2860 * bindings/c/c_instance.cpp:
2861 (CInstance::invokeMethod):
2862 * bindings/c/c_utility.cpp:
2863 (coerceValueToNPString):
2864 (convertValueToNPValueType):
2865 (convertNPValueTypeToValue):
2866 * bindings/c/c_utility.h:
2868 * bindings/testC.js: Added.
2869 * bindings/testbindings.cpp:
2879 (myInterfaceInvoke):
2880 (myInterfaceAllocate):
2884 2004-03-19 Darin Adler <darin@apple.com>
2888 - fixed problem with methods like setUTCHour
2890 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2891 GMT vs. local time function based on the utc flag.
2893 2004-03-17 Richard Williamson <rjw@apple.com>
2895 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2899 * bindings/NP_jsobject.cpp:
2904 (NP_GetPropertyAtIndex):
2905 * bindings/NP_runtime.h:
2907 2004-03-16 Richard Williamson <rjw@apple.com>
2909 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.
2913 * bindings/jni/jni_class.cpp:
2914 (JavaClass::methodsNamed):
2916 2004-03-15 Richard Williamson <rjw@apple.com>
2918 Fixed 3570854. Don't attempt to convert Null to strings. We
2919 were incorrectly converting to "Null".
2921 Actually fixed by Scott Kovatch.
2923 Reviewed by Richard.
2925 * bindings/jni/jni_utility.cpp:
2926 (KJS::Bindings::convertValueToJValue):
2930 2004-03-11 Richard Williamson <rjw@apple.com>
2932 Stitched together the NP stuff to our language independent
2933 JavaScript binding stuff. Very close to being done.
2935 Added program to test C bindings (and NP stuff). Just tests
2936 properties. Will add methods and JavaScript access, etc.
2938 Updated Makefile.am to account for new bindings/c directory.
2940 Change NP_UTF8 from "const char *" to "char" to allow for
2941 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2944 Added NP_IsValidIdentifier().
2948 * JavaScriptCore.pbproj/project.pbxproj:
2950 * bindings/NP_jsobject.cpp:
2951 (identiferFromNPIdentifier):
2953 * bindings/NP_runtime.cpp:
2954 (NP_IdentifierFromUTF8):
2955 (NP_IsValidIdentifier):
2956 (NP_GetIdentifiers):
2957 (NP_UTF8FromIdentifier):
2958 (NP_SetExceptionWithUTF8):
2960 (NP_CreateStringWithUTF8):
2961 (NP_CreateStringWithUTF16):
2962 (NP_UTF8FromString):
2963 (NP_UTF16FromString):
2964 * bindings/NP_runtime.h:
2965 * bindings/c/c_class.cpp: Added.
2966 (CClass::_commonDelete):
2967 (CClass::_commonCopy):
2968 (CClass::_commonInit):
2969 (_createClassesByIsAIfNecessary):
2970 (CClass::classForIsA):
2973 (CClass::methodsNamed):
2974 (CClass::fieldNamed):
2975 * bindings/c/c_class.h: Added.
2976 (KJS::Bindings::CClass::~CClass):
2977 (KJS::Bindings::CClass::CClass):
2978 (KJS::Bindings::CClass::operator=):
2979 (KJS::Bindings::CClass::constructorAt):
2980 (KJS::Bindings::CClass::numConstructors):
2981 * bindings/c/c_instance.cpp: Added.
2982 (CInstance::CInstance):
2983 (CInstance::~CInstance):
2984 (CInstance::operator=):
2985 (CInstance::getClass):
2988 (CInstance::invokeMethod):
2989 (CInstance::defaultValue):
2990 (CInstance::stringValue):
2991 (CInstance::numberValue):
2992 (CInstance::booleanValue):
2993 (CInstance::valueOf):
2994 * bindings/c/c_instance.h: Added.
2995 (KJS::Bindings::CInstance::getObject):
2996 * bindings/c/c_runtime.cpp: Added.
2997 (CField::valueFromInstance):
2998 (CField::setValueToInstance):
2999 * bindings/c/c_runtime.h: Added.
3000 (KJS::Bindings::CField::CField):
3001 (KJS::Bindings::CField::name):
3002 (KJS::Bindings::CField::type):
3003 (KJS::Bindings::CMethod::CMethod):
3004 (KJS::Bindings::CMethod::name):
3005 (KJS::Bindings::CMethod::numParameters):
3006 * bindings/c/c_utility.cpp: Added.
3007 (coerceValueToNPValueType):
3008 (convertValueToNPValueType):
3009 (convertNPValueTypeToValue):
3010 * bindings/c/c_utility.h: Added.
3011 * bindings/make_testbindings:
3012 * bindings/runtime.cpp:
3013 (Instance::createBindingForLanguageInstance):
3014 * bindings/runtime.h:
3015 (KJS::Bindings::Instance::):
3016 * bindings/testbindings.cpp: Added.
3017 (initializeIdentifiers):
3018 (myInterfaceHasProperty):
3019 (myInterfaceHasMethod):
3020 (myInterfaceGetProperty):
3021 (myInterfaceSetProperty):
3022 (myInterfaceInvoke):
3023 (myInterfaceAllocate):
3024 (myInterfaceInvalidate):
3025 (myInterfaceDeallocate):
3026 (GlobalImp::className):
3027 (readJavaScriptFromFile):
3030 2004-03-10 Richard Williamson <rjw@apple.com>
3032 Made changes to support new asychronous approach to calls from
3033 plugin to JavaScript
3037 * bindings/NP_jsobject.cpp:
3042 (NP_GetPropertyAtIndex):
3043 * bindings/NP_runtime.h:
3044 * bindings/make_testbindings:
3045 * bindings/runtime.cpp:
3046 (Instance::createBindingForLanguageInstance):
3048 2004-03-10 Richard Williamson <rjw@apple.com>
3050 Updated header to include proposed changes from
3051 plugin-futures list. Calls from plugin to JavaScript
3052 are now asynchronous.
3056 * bindings/NP_runtime.h:
3060 2004-03-04 Richard Williamson <rjw@apple.com>
3062 Implementation of NP_JavaScriptObject. This is the 'C' class
3063 that wraps a JavaScript object.
3067 * JavaScriptCore.pbproj/project.pbxproj:
3068 * bindings/NP_jsobject.cpp: Added.
3069 (coerceValueToNPValueType):
3070 (convertValueToNPValueType):
3071 (convertNPValueTypeToValue):
3075 (identiferFromNPIdentifier):
3080 (NP_RemoveProperty):
3082 (NP_GetPropertyAtIndex):
3083 (NP_SetPropertyAtIndex):
3084 * bindings/NP_runtime.cpp:
3086 * bindings/NP_runtime.h:
3087 * bindings/runtime_object.h:
3089 2004-03-04 Richard Williamson <rjw@apple.com>
3091 Added NP_Array implementation.
3093 Changed NP_Boolean to just depend on two static instances, no
3094 space is required for values.
3098 * bindings/NP_runtime.cpp:
3100 (NP_BoolFromBoolean):
3106 * bindings/NP_runtime.h:
3108 2004-03-03 Darin Adler <darin@apple.com>
3112 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
3113 copyright string, and that's all that was in here.
3114 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
3116 2004-03-03 Richard Williamson <rjw@apple.com>
3118 More 'C' binding implementation. Fleshed out all the
3119 'primitive' data types.
3123 * bindings/NP_runtime.cpp:
3128 (NP_CreateStringWithUTF8):
3129 (NP_CreateStringWithUTF16):
3130 (NP_UTF8FromString):
3131 (NP_UTF16FromString):
3134 (booleanDeallocate):
3136 (NP_BoolFromBoolean):
3140 (undefinedAllocate):
3141 (undefinedDeallocate):
3143 * bindings/NP_runtime.h:
3145 2004-03-03 Richard Williamson <rjw@apple.com>
3147 More 'C' binding implementation.
3151 * bindings/NP_runtime.cpp:
3154 (getIdentifierDictionary):
3155 (NP_IdentifierFromUTF8):
3156 (NP_UTF8FromIdentifier):
3161 (NP_CreateNumberWithInt):
3162 (NP_CreateNumberWithFloat):
3163 (NP_CreateNumberWithDouble):
3165 (NP_FloatFromNumber):
3166 (NP_DoubleFromNumber):
3167 * bindings/NP_runtime.h:
3169 2004-03-02 Richard Williamson <rjw@apple.com>
3171 Removed retain/release from NP_Class. Classes will not be allowed to implement their
3172 own customer retain/release scheme.
3176 * bindings/NP_runtime.cpp:
3179 * bindings/NP_runtime.h:
3181 2004-03-02 Richard Williamson <rjw@apple.com>
3183 C binding API. Partial implementation.
3185 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.
3187 Factored root object reference counting scheme. It is now useful independent
3192 * JavaScriptCore.pbproj/project.pbxproj:
3193 * bindings/NP_runtime.cpp: Added.
3194 (NP_IdentifierFromUTF8):
3195 (NP_GetIdentifiers):
3196 (NP_UTF8FromIdentifier):
3206 (NP_RemoveProperty):
3208 (NP_GetPropertyAtIndex):
3209 (NP_SetPropertyAtIndex):
3210 (NP_CreateNumberWithInt):
3211 (NP_CreateNumberWithFloat):
3212 (NP_CreateNumberWithDouble):
3214 (NP_FloatFromNumber):
3215 (NP_DoubleFromNumber):
3216 (NP_CreateStringWithUTF8):
3217 (NP_CreateStringWithUTF16):
3218 (NP_UTF8FromString):
3219 (NP_UTF16FromString):
3221 (NP_BoolFromBoolean):
3227 * bindings/NP_runtime.h: Added.
3228 * bindings/jni/jni_jsobject.cpp:
3230 (JSObject::finalize):
3231 (JSObject::createNative):
3232 (JSObject::convertValueToJObject):
3233 * bindings/jni/jni_jsobject.h:
3234 * bindings/objc/objc_jsobject.h:
3235 * bindings/objc/objc_jsobject.mm:
3237 (windowJavaScriptObject):
3238 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3239 (-[JavaScriptObject dealloc]):
3240 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
3241 (-[JavaScriptObject call:arguments:]):
3242 (-[JavaScriptObject evaluate:]):
3243 (-[JavaScriptObject getMember:]):
3244 (-[JavaScriptObject setMember:value:]):
3245 (-[JavaScriptObject removeMember:]):
3246 (-[JavaScriptObject toString]):
3247 (-[JavaScriptObject getSlot:]):
3248 (-[JavaScriptObject setSlot:value:]):
3249 * bindings/objc/objc_utility.h:
3250 * bindings/objc/objc_utility.mm:
3251 (KJS::Bindings::convertValueToObjcValue):
3252 * bindings/runtime_root.cpp: Added.
3253 (getReferencesByRootDictionary):
3254 (getReferencesDictionary):
3255 (KJS::Bindings::findReferenceDictionary):
3256 (KJS::Bindings::rootForImp):
3257 (KJS::Bindings::addNativeReference):
3258 (KJS::Bindings::removeNativeReference):
3259 (completedJavaScriptAccess):
3260 (initializeJavaScriptAccessLock):
3261 (lockJavaScriptAccess):
3262 (unlockJavaScriptAccess):
3263 (RootObject::dispatchToJavaScriptThread):
3264 (performJavaScriptAccess):
3265 (RootObject::setFindRootObjectForNativeHandleFunction):
3266 (RootObject::removeAllNativeReferences):
3267 * bindings/runtime_root.h: Added.
3268 (KJS::Bindings::RootObject::RootObject):
3269 (KJS::Bindings::RootObject::~RootObject):
3270 (KJS::Bindings::RootObject::setRootObjectImp):
3271 (KJS::Bindings::RootObject::rootObjectImp):
3272 (KJS::Bindings::RootObject::setInterpreter):
3273 (KJS::Bindings::RootObject::interpreter):
3274 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
3275 (KJS::Bindings::RootObject::runLoop):
3276 (KJS::Bindings::RootObject::performJavaScriptSource):
3282 2004-02-18 Richard Williamson <rjw@apple.com>
3284 Added NSNumber/Number conversion.
3286 Removed some unnecessary KJS:: namespace specifiers.
3290 * bindings/objc/objc_utility.mm:
3291 (KJS::Bindings::convertValueToObjcValue):
3292 (KJS::Bindings::convertObjcValueToValue):
3293 * bindings/runtime_array.h:
3295 2004-02-18 Richard Williamson <rjw@apple.com>
3297 Added support for export NSArrays.
3299 Updated valueAt() to take an ExecState so we can throw
3302 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
3303 ObjectiveC classes to control the visibility of their methods in
3308 * bindings/jni/jni_runtime.cpp:
3309 (JavaField::valueFromInstance):
3310 (JavaArray::valueAt):
3311 * bindings/jni/jni_runtime.h:
3312 * bindings/objc/objc_class.mm:
3313 (ObjcClass::methodsNamed):
3314 * bindings/objc/objc_runtime.h:
3315 (KJS::Bindings::ObjcArray::getObjcArray):
3316 * bindings/objc/objc_runtime.mm:
3317 (ObjcField::valueFromInstance):
3318 (ObjcField::setValueToInstance):
3319 (ObjcArray::ObjcArray):
3320 (ObjcArray::~ObjcArray):
3321 (ObjcArray::operator=):
3322 (ObjcArray::setValueAt):
3323 (ObjcArray::valueAt):
3324 (ObjcArray::getLength):
3325 * bindings/objc/objc_utility.mm:
3326 (KJS::Bindings::convertValueToObjcValue):
3327 (KJS::Bindings::convertObjcValueToValue):
3328 * bindings/runtime.cpp:
3329 (Instance::getValueOfField):
3330 * bindings/runtime.h:
3331 * bindings/runtime_array.cpp:
3332 (RuntimeArrayImp::get):
3333 * bindings/runtime_object.cpp:
3334 (RuntimeObjectImp::get):
3336 2004-02-17 Richard Williamson <rjw@apple.com>
3338 Added String <-> NSString conversion.
3339 Added tests of String <-> NSString conversion to test program.
3343 * bindings/objc/objc_utility.mm:
3344 (KJS::Bindings::convertValueToObjcValue):
3345 (KJS::Bindings::convertObjcValueToValue):
3347 * bindings/testbindings.mm:
3348 (-[MyFirstInterface getString]):
3350 2004-02-15 Darin Adler <darin@apple.com>
3354 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
3355 and removing redundant settings of things that match defaults in other build styles.
3357 2004-02-13 Richard Williamson <rjw@apple.com>
3359 Work towards the JavaScript ObjC bindings. The bindings now work for
3360 simple scalar types. testbindings.mm is an illustration of how the
3365 * JavaScriptCore.pbproj/project.pbxproj:
3367 * bindings/jni/jni_class.cpp:
3368 (JavaClass::methodsNamed):
3369 * bindings/jni/jni_class.h:
3370 * bindings/jni/jni_instance.cpp:
3371 (JavaInstance::invokeMethod):
3372 * bindings/jni/jni_instance.h:
3373 * bindings/jni/jni_runtime.h:
3374 (KJS::Bindings::JavaMethod::returnType):
3375 * bindings/make_testbindings: Added.
3376 * bindings/objc/objc_class.h: Added.
3377 (KJS::Bindings::ObjcClass::~ObjcClass):
3378 (KJS::Bindings::ObjcClass::ObjcClass):
3379 (KJS::Bindings::ObjcClass::operator=):
3380 (KJS::Bindings::ObjcClass::constructorAt):
3381 (KJS::Bindings::ObjcClass::numConstructors):
3382 * bindings/objc/objc_class.mm: Added.
3383 (ObjcClass::_commonDelete):
3384 (ObjcClass::_commonCopy):
3385 (ObjcClass::_commonInit):
3386 (_createClassesByIsAIfNecessary):
3387 (ObjcClass::classForIsA):
3388 (ObjcClass::ObjcClass):
3390 (ObjcClass::methodsNamed):
3391 (ObjcClass::fieldNamed):
3392 * bindings/objc/objc_header.h: Added.
3393 * bindings/objc/objc_instance.h: Added.
3394 (KJS::Bindings::ObjcInstance::getObject):
3395 * bindings/objc/objc_instance.mm: Added.
3396 (ObjcInstance::ObjcInstance):
3397 (ObjcInstance::~ObjcInstance):
3398 (ObjcInstance::operator=):
3399 (ObjcInstance::begin):
3400 (ObjcInstance::end):
3401 (ObjcInstance::getClass):
3402 (ObjcInstance::invokeMethod):
3403 (ObjcInstance::defaultValue):
3404 (ObjcInstance::stringValue):
3405 (ObjcInstance::numberValue):
3406 (ObjcInstance::booleanValue):
3407 (ObjcInstance::valueOf):
3408 * bindings/objc/objc_jsobject.h: Added.
3409 * bindings/objc/objc_jsobject.mm: Added.
3410 * bindings/objc/objc_runtime.h:
3411 (KJS::Bindings::ObjcField::~ObjcField):
3412 (KJS::Bindings::ObjcField::ObjcField):
3413 (KJS::Bindings::ObjcField::operator=):
3414 (KJS::Bindings::ObjcMethod::ObjcMethod):
3415 (KJS::Bindings::ObjcMethod::~ObjcMethod):
3416 (KJS::Bindings::ObjcMethod::operator=):
3417 * bindings/objc/objc_runtime.mm: Added.
3418 (ObjcMethod::ObjcMethod):
3420 (ObjcMethod::numParameters):
3421 (ObjcMethod::getMethodSignature):
3422 (ObjcField::ObjcField):
3425 (ObjcField::valueFromInstance):
3426 (ObjcField::setValueToInstance):
3427 * bindings/objc/objc_utility.h: Added.
3429 * bindings/objc/objc_utility.mm: Added.
3430 (KJS::Bindings::JSMethodNameToObjCMethodName):
3431 (KJS::Bindings::convertValueToObjcValue):
3432 (KJS::Bindings::convertObjcValueToValue):
3433 (KJS::Bindings::objcValueTypeForType):
3434 * bindings/runtime.cpp:
3435 (MethodList::MethodList):
3436 (MethodList::operator=):
3437 (Instance::setValueOfField):
3438 (Instance::createBindingForLanguageInstance):
3439 (Instance::createRuntimeObject):
3440 * bindings/runtime.h:
3441 * bindings/runtime_method.cpp:
3442 (RuntimeMethodImp::RuntimeMethodImp):
3443 (RuntimeMethodImp::get):
3444 (RuntimeMethodImp::call):
3445 * bindings/runtime_method.h:
3446 * bindings/runtime_object.cpp:
3447 (RuntimeObjectImp::get):
3448 (RuntimeObjectImp::hasProperty):
3449 * bindings/test.js: Added.
3450 * bindings/testbindings.mm: Added.
3451 (-[MySecondInterface init]):
3452 (-[MyFirstInterface init]):
3453 (-[MyFirstInterface dealloc]):
3454 (+[MyFirstInterface JavaScriptNameForSelector:]):
3455 (-[MyFirstInterface getInt]):
3456 (-[MyFirstInterface setInt:]):
3457 (-[MyFirstInterface getMySecondInterface]):
3458 (-[MyFirstInterface logMessage:]):
3459 (GlobalImp::className):
3460 (readJavaScriptFromFile):
3465 2004-02-08 Darin Adler <darin@apple.com>
3469 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
3471 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
3472 macros from working right in C++ code that uses the <cctype> header.
3475 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
3476 (KJS::UTF8SequenceLengthNonASCII): Added.
3477 (KJS::inlineUTF8SequenceLength): Added.
3478 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
3479 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3480 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
3481 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3482 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3484 - fixed the test program so it won't hit the interpreter lock assertion
3486 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3490 2004-02-06 Richard Williamson <rjw@apple.com>
3492 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.
3496 * bindings/jni/jni_jsobject.cpp:
3497 (JSObject::toString):
3498 * bindings/jni/jni_utility.cpp:
3499 (KJS::Bindings::convertValueToJValue):
3501 2004-02-02 Darin Adler <darin@apple.com>
3505 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3507 * kjs/array_object.cpp:
3508 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3509 we start putting values in. This prevents new Array(2147483647) from causing trouble.
3510 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3511 number is out of range. This prevents new Array(-1) from causing trouble.
3513 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3515 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3516 casting to int. Results now match those in other browsers.
3518 2004-02-02 Darin Adler <darin@apple.com>
3522 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3523 - fixed other related overflow issues
3525 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3527 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3528 must not restrict values to the range of a particular integer type.
3529 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3530 proper handling for negative results from fmod.
3531 (ValueImp::toUInt32): Ditto.
3532 (ValueImp::toUInt16): Ditto.
3533 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3535 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3536 out-of-integer-range values better in the slice function.
3537 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3538 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3539 out-of-integer-range values better in the toString function.
3540 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3541 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3542 and substr functions.
3546 2004-01-30 Richard Williamson <rjw@apple.com>
3548 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
3552 * bindings/jni/jni_instance.cpp:
3553 (JavaInstance::stringValue):
3555 2004-01-26 Darin Adler <darin@apple.com>
3557 * Makefile.am: Switch from pbxbuild to xcodebuild.
3559 2004-01-22 Richard Williamson <rjw@apple.com>
3561 Added stubs for ObjC language binding to JavaScript.
3563 * JavaScriptCore.pbproj/project.pbxproj:
3564 * bindings/jni/jni_runtime.h:
3565 * bindings/objc/objc_runtime.h: Added.
3566 (KJS::Bindings::ObjcParameter::ObjcParameter):
3567 (KJS::Bindings::ObjcParameter::~ObjcParameter):
3568 (KJS::Bindings::ObjcParameter::operator=):
3569 (KJS::Bindings::ObjcParameter::type):
3570 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
3571 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
3572 (KJS::Bindings::ObjcConstructor::_commonCopy):
3573 (KJS::Bindings::ObjcConstructor::operator=):