return toRef(exec->dynamicInterpreter()->globalObject());
}
-JSValueRef JSEvaluate(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
+JSValueRef JSEvaluateScript(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
{
JSLock lock;
ExecState* exec = toJS(context);
return toRef(jsUndefined());
}
-bool JSCheckSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
+bool JSCheckScriptSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
{
JSLock lock;
@param thisObject The object to use as "this," or NULL to use the global object as "this."
@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
-@param exception A pointer to a JSValueRef in which to store an uncaught exception, if any. Pass NULL if you do not care to store an uncaught exception.
-@result The JSValue that results from evaluating script, or NULL if an uncaught exception is thrown.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The JSValue that results from evaluating script, or NULL if an exception is thrown.
*/
-JSValueRef JSEvaluate(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
+JSValueRef JSEvaluateScript(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
/*!
-@function JSCheckSyntax
+@function JSCheckScriptSyntax
@abstract Checks for syntax errors in a string of JavaScript.
@param context The execution context to use.
@param script A JSString containing the script to check for syntax errors.
@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
@result true if the script is syntactically correct, otherwise false.
*/
-bool JSCheckSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
+bool JSCheckScriptSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
#ifdef __cplusplus
}
JSStringRelease(message);
} else {
Node* node = JSObjectGetPrivate(thisObject);
- Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
+ Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
Node_appendChild(node, child);
}
if (JSValueIsObjectOfClass(thisObject, JSNode_class(context))) {
if (JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
Node* node = JSObjectGetPrivate(thisObject);
- Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
+ Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
Node_removeChild(node, child);
}
if (JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
if (JSValueIsObjectOfClass(argv[1], JSNode_class(context))) {
Node* node = JSObjectGetPrivate(thisObject);
- Node* newChild = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
- Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, argv[1]));
+ Node* newChild = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
+ Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, argv[1], NULL));
Node_replaceChild(node, newChild, oldChild);
}
if (argc > 0) {
NodeList* nodeList = JSObjectGetPrivate(thisObject);
assert(nodeList);
- Node* node = NodeList_item(nodeList, JSValueToNumber(context, argv[0]));
+ Node* node = NodeList_item(nodeList, JSValueToNumber(context, argv[0], exception));
if (node)
return JSNode_new(context, node);
}
{
NodeList* nodeList = JSObjectGetPrivate(thisObject);
assert(nodeList);
- double index = JSValueToNumber(context, JSValueMakeString(propertyName));
+ double index = JSValueToNumber(context, JSValueMakeString(propertyName), exception);
unsigned uindex = index;
if (uindex == index) { // false for NaN
Node* node = NodeList_item(nodeList, uindex);
return toRef(static_cast<JSObject*>(new DeclaredFunctionImp(exec, "anonymous", bodyNode.get(), scopeChain)));
}
-JSStringRef JSObjectGetDescription(JSObjectRef object)
-{
- JSLock lock;
- JSObject* jsObject = toJS(object);
- return toRef(jsObject->className().rep());
-}
-
JSValueRef JSObjectGetPrototype(JSObjectRef object)
{
JSObject* jsObject = toJS(object);
*/
JSObjectRef JSObjectMakeFunctionWithBody(JSContextRef context, JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
-/*!
-@function
-@abstract Gets a short description of a JavaScript object.
-@param context The execution context to use.
-@param object The object whose description you want to get.
-@result A JSString containing the object's description. This is usually the object's class name.
-*/
-JSStringRef JSObjectGetDescription(JSObjectRef object);
-
/*!
@function
@abstract Gets an object's prototype.
/*!
@function
-@abstract Tests whether an object is a function.
+@abstract Tests whether an object can be called as a function.
@param object The JSObject to test.
-@result true if the object is a function, otherwise false.
+@result true if the object can be called as a function, otherwise false.
*/
bool JSObjectIsFunction(JSObjectRef object);
/*!
JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
/*!
@function
-@abstract Tests whether an object is a constructor.
+@abstract Tests whether an object can be called as a constructor.
@param object The JSObject to test.
-@result true if the object is a constructor, otherwise false.
+@result true if the object can be called as a constructor, otherwise false.
*/
bool JSObjectIsConstructor(JSObjectRef object);
/*!
rep->deref();
}
-JSStringRef JSValueToStringCopy(JSContextRef context, JSValueRef value)
-{
- JSLock lock;
- JSValue* jsValue = toJS(value);
- ExecState* exec = toJS(context);
-
- JSStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
- if (exec->hadException())
- exec->clearException();
- return stringRef;
-}
-
size_t JSStringGetLength(JSStringRef string)
{
UString::Rep* rep = toJS(string);
return false;
}
-bool JSValueIsEqual(JSContextRef context, JSValueRef a, JSValueRef b)
+bool JSValueIsEqual(JSContextRef context, JSValueRef a, JSValueRef b, JSValueRef* exception)
{
JSLock lock;
ExecState* exec = toJS(context);
JSValue* jsA = toJS(a);
JSValue* jsB = toJS(b);
- bool result = equal(exec, jsA, jsB);
- if (exec->hadException())
+ bool result = equal(exec, jsA, jsB); // false if an exception is thrown
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec->exception());
exec->clearException();
+ }
return result;
}
JSValue* jsA = toJS(a);
JSValue* jsB = toJS(b);
- bool result = strictEqual(exec, jsA, jsB);
- if (exec->hadException())
- exec->clearException();
+ bool result = strictEqual(exec, jsA, jsB); // can't throw because it doesn't perform value conversion
+ ASSERT(!exec->hadException());
return result;
}
return toRef(jsNumber(value));
}
-bool JSValueToBoolean(JSContextRef context, JSValueRef value)
+bool JSValueToBoolean(JSContextRef context, JSValueRef value, JSValueRef* exception)
{
JSLock lock;
ExecState* exec = toJS(context);
bool boolean = jsValue->toBoolean(exec);
if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec->exception());
exec->clearException();
boolean = false;
}
return boolean;
}
-double JSValueToNumber(JSContextRef context, JSValueRef value)
+double JSValueToNumber(JSContextRef context, JSValueRef value, JSValueRef* exception)
{
JSLock lock;
JSValue* jsValue = toJS(value);
double number = jsValue->toNumber(exec);
if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec->exception());
exec->clearException();
number = NaN;
}
return number;
}
-JSObjectRef JSValueToObject(JSContextRef context, JSValueRef value)
+JSStringRef JSValueToStringCopy(JSContextRef context, JSValueRef value, JSValueRef* exception)
+{
+ JSLock lock;
+ JSValue* jsValue = toJS(value);
+ ExecState* exec = toJS(context);
+
+ JSStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec->exception());
+ exec->clearException();
+ stringRef = 0;
+ }
+ return stringRef;
+}
+
+JSObjectRef JSValueToObject(JSContextRef context, JSValueRef value, JSValueRef* exception)
{
JSLock lock;
ExecState* exec = toJS(context);
JSObjectRef objectRef = toRef(jsValue->toObject(exec));
if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec->exception());
exec->clearException();
objectRef = 0;
}
/*!
@function
-@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator.
-@param context The execution context to use.
-@param a The first value to test.
-@param b The second value to test.
-@result true if the two values are equal, otherwise false.
+@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator.
+@param context The execution context to use.
+@param a The first value to test.
+@param b The second value to test.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result true if the two values are equal, false if they are not equal or an exception is thrown.
*/
-bool JSValueIsEqual(JSContextRef context, JSValueRef a, JSValueRef b);
+bool JSValueIsEqual(JSContextRef context, JSValueRef a, JSValueRef b, JSValueRef* exception);
/*!
@function
@abstract Converts a JavaScript value to boolean and returns the resulting boolean.
@param context The execution context to use.
@param value The JSValue to convert.
-@result The boolean result of conversion.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The boolean result of conversion, or false if an exception is thrown.
*/
-bool JSValueToBoolean(JSContextRef context, JSValueRef value);
+bool JSValueToBoolean(JSContextRef context, JSValueRef value, JSValueRef* exception);
/*!
@function
@abstract Converts a JavaScript value to number and returns the resulting number.
@param context The execution context to use.
@param value The JSValue to convert.
-@result The numeric result of conversion, or NaN if conversion fails.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The numeric result of conversion, or NaN if an exception is thrown.
*/
-double JSValueToNumber(JSContextRef context, JSValueRef value);
+double JSValueToNumber(JSContextRef context, JSValueRef value, JSValueRef* exception);
/*!
@function
@abstract Converts a JavaScript value to string and copies the result into a JavaScript string.
@param context The execution context to use.
@param value The JSValue to convert.
-@result A JSString with the result of conversion, or an empty string if conversion fails. Ownership follows the Create Rule.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
*/
-JSStringRef JSValueToStringCopy(JSContextRef context, JSValueRef value);
+JSStringRef JSValueToStringCopy(JSContextRef context, JSValueRef value, JSValueRef* exception);
/*!
@function
@abstract Converts a JavaScript value to object and returns the resulting object.
@param context The execution context to use.
@param value The JSValue to convert.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
@result The JSObject result of conversion, or NULL if conversion fails.
*/
-JSObjectRef JSValueToObject(JSContextRef context, JSValueRef value);
+JSObjectRef JSValueToObject(JSContextRef context, JSValueRef value, JSValueRef* exception);
// Garbage collection
/*!
char* scriptUTF8 = createStringWithContentsOfFile("minidom.js");
JSStringRef script = JSStringCreateWithUTF8CString(scriptUTF8);
JSValueRef exception;
- JSValueRef result = JSEvaluate(context, script, NULL, NULL, 0, &exception);
+ JSValueRef result = JSEvaluateScript(context, script, NULL, NULL, 0, &exception);
if (result)
printf("PASS: Test script executed successfully.\n");
else {
printf("FAIL: Test script threw exception:\n");
- JSStringRef exceptionIString = JSValueToStringCopy(context, exception);
+ JSStringRef exceptionIString = JSValueToStringCopy(context, exception, NULL);
CFStringRef exceptionCF = JSStringCopyCFString(kCFAllocatorDefault, exceptionIString);
CFShow(exceptionCF);
CFRelease(exceptionCF);
static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
{
if (argc > 0) {
- JSStringRef string = JSValueToStringCopy(context, argv[0]);
+ JSStringRef string = JSValueToStringCopy(context, argv[0], NULL);
size_t numChars = JSStringGetMaximumUTF8CStringSize(string);
char stringUTF8[numChars];
JSStringGetUTF8CString(string, stringUTF8, numChars);
static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue)
{
- if (JSValueToBoolean(context, value) != expectedValue)
+ if (JSValueToBoolean(context, value, NULL) != expectedValue)
fprintf(stderr, "assertEqualsAsBoolean failed: %p, %d\n", value, expectedValue);
}
static void assertEqualsAsNumber(JSValueRef value, double expectedValue)
{
- double number = JSValueToNumber(context, value);
+ double number = JSValueToNumber(context, value, NULL);
if (number != expectedValue && !(isnan(number) && isnan(expectedValue)))
fprintf(stderr, "assertEqualsAsNumber failed: %p, %lf\n", value, expectedValue);
}
static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue)
{
- JSStringRef valueAsString = JSValueToStringCopy(context, value);
+ JSStringRef valueAsString = JSValueToStringCopy(context, value, NULL);
size_t jsSize = JSStringGetMaximumUTF8CStringSize(valueAsString);
char jsBuffer[jsSize];
#if defined(__APPLE__)
static void assertEqualsAsCharactersPtr(JSValueRef value, const char* expectedValue)
{
- JSStringRef valueAsString = JSValueToStringCopy(context, value);
+ JSStringRef valueAsString = JSValueToStringCopy(context, value, NULL);
size_t jsLength = JSStringGetLength(valueAsString);
const JSChar* jsBuffer = JSStringGetCharactersPtr(valueAsString);
UNUSED_PARAM(object);
if (argc > 0 && JSValueIsStrictEqual(context, argv[0], JSValueMakeNumber(0)))
- return JSValueToObject(context, JSValueMakeNumber(1));
+ return JSValueToObject(context, JSValueMakeNumber(1), NULL);
- return JSValueToObject(context, JSValueMakeNumber(0));
+ return JSValueToObject(context, JSValueMakeNumber(0), NULL);
}
static bool MyObject_hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleValue, JSValueRef* exception)
UNUSED_PARAM(context);
JSStringRef numberString = JSStringCreateWithUTF8CString("Number");
- JSObjectRef numberConstructor = JSValueToObject(context, JSObjectGetProperty(context, JSContextGetGlobalObject(context), numberString));
+ JSObjectRef numberConstructor = JSValueToObject(context, JSObjectGetProperty(context, JSContextGetGlobalObject(context), numberString), NULL);
JSStringRelease(numberString);
return JSValueIsInstanceOfConstructor(context, possibleValue, numberConstructor);
switch (type) {
case kJSTypeBoolean:
- return JSValueMakeBoolean(false); // default object conversion is 'true'
+ *exception = JSValueMakeNumber(2);
+ return NULL;
case kJSTypeNumber:
return JSValueMakeNumber(1);
default:
UNUSED_PARAM(thisObject);
if (argc > 0) {
- JSStringRef string = JSValueToStringCopy(context, argv[0]);
+ JSStringRef string = JSValueToStringCopy(context, argv[0], NULL);
size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string);
char stringUTF8[sizeUTF8];
JSStringGetUTF8CString(string, stringUTF8, sizeUTF8);
UNUSED_PARAM(argv);
context = JSContextCreate(NULL);
-
+
+ JSObjectRef globalObject = JSContextGetGlobalObject(context);
+ assert(JSValueIsObject(globalObject));
+
JSValueRef jsUndefined = JSValueMakeUndefined();
JSValueRef jsNull = JSValueMakeNull();
JSValueRef jsTrue = JSValueMakeBoolean(true);
assert(JSValueGetType(jsCFEmptyStringWithCharacters) == kJSTypeString);
#endif // __APPLE__
+ JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL);
+ assert(didInitialize);
+ JSStringRef myObjectIString = JSStringCreateWithUTF8CString("MyObject");
+ JSObjectSetProperty(context, globalObject, myObjectIString, myObject, kJSPropertyAttributeNone);
+ JSStringRelease(myObjectIString);
+
+ JSValueRef exception;
+
// Conversions that throw exceptions
- assert(NULL == JSValueToObject(context, jsNull));
- assert(isnan(JSValueToNumber(context, jsObjectNoProto)));
- assertEqualsAsCharactersPtr(jsObjectNoProto, "");
+ exception = NULL;
+ assert(NULL == JSValueToObject(context, jsNull, &exception));
+ assert(exception);
+
+ exception = NULL;
+ assert(isnan(JSValueToNumber(context, jsObjectNoProto, &exception)));
+ assert(exception);
+
+ exception = NULL;
+ assert(!JSValueToStringCopy(context, jsObjectNoProto, &exception));
+ assert(exception);
+
+ exception = NULL;
+ assert(!JSValueToBoolean(context, myObject, &exception));
+ assert(exception);
+
+ exception = NULL;
+ assert(!JSValueIsEqual(context, jsObjectNoProto, JSValueMakeNumber(1), &exception));
+ assert(exception);
assertEqualsAsBoolean(jsUndefined, false);
assertEqualsAsBoolean(jsNull, false);
assert(JSValueIsStrictEqual(context, jsTrue, jsTrue));
assert(!JSValueIsStrictEqual(context, jsOne, jsOneString));
- assert(JSValueIsEqual(context, jsOne, jsOneString));
- assert(!JSValueIsEqual(context, jsTrue, jsFalse));
+ assert(JSValueIsEqual(context, jsOne, jsOneString, NULL));
+ assert(!JSValueIsEqual(context, jsTrue, jsFalse, NULL));
#if defined(__APPLE__)
CFStringRef cfJSString = JSStringCopyCFString(kCFAllocatorDefault, jsCFIString);
assert(JSValueIsObject(jsGlobalValue));
JSValueUnprotect(jsGlobalValue);
- /* JSInterpreter.h */
-
- JSObjectRef globalObject = JSContextGetGlobalObject(context);
- assert(JSValueIsObject(globalObject));
-
JSStringRef goodSyntax = JSStringCreateWithUTF8CString("x = 1;");
JSStringRef badSyntax = JSStringCreateWithUTF8CString("x := 1;");
- assert(JSCheckSyntax(context, goodSyntax, NULL, 0, NULL));
- assert(!JSCheckSyntax(context, badSyntax, NULL, 0, NULL));
+ assert(JSCheckScriptSyntax(context, goodSyntax, NULL, 0, NULL));
+ assert(!JSCheckScriptSyntax(context, badSyntax, NULL, 0, NULL));
JSValueRef result;
- JSValueRef exception;
JSValueRef v;
JSObjectRef o;
- result = JSEvaluate(context, goodSyntax, NULL, NULL, 1, NULL);
+ result = JSEvaluateScript(context, goodSyntax, NULL, NULL, 1, NULL);
assert(result);
- assert(JSValueIsEqual(context, result, jsOne));
+ assert(JSValueIsEqual(context, result, jsOne, NULL));
exception = NULL;
- result = JSEvaluate(context, badSyntax, NULL, NULL, 1, &exception);
+ result = JSEvaluateScript(context, badSyntax, NULL, NULL, 1, &exception);
assert(!result);
assert(JSValueIsObject(exception));
JSStringRef array = JSStringCreateWithUTF8CString("Array");
v = JSObjectGetProperty(context, globalObject, array);
assert(v);
- JSObjectRef arrayConstructor = JSValueToObject(context, v);
+ JSObjectRef arrayConstructor = JSValueToObject(context, v, NULL);
JSStringRelease(array);
result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL);
assert(result);
JSStringRef line = JSStringCreateWithUTF8CString("line");
assert(!JSObjectMakeFunctionWithBody(context, functionBody, NULL, 1, &exception));
assert(JSValueIsObject(exception));
- v = JSObjectGetProperty(context, JSValueToObject(context, exception), line);
+ v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line);
assert(v);
assertEqualsAsNumber(v, 2); // FIXME: Lexer::setCode bumps startingLineNumber by 1 -- we need to change internal callers so that it doesn't have to (saying '0' to mean '1' in the API would be really confusing -- it's really confusing internally, in fact)
JSStringRelease(functionBody);
assert(JSObjectIsFunction(function));
v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
- assert(JSValueIsEqual(context, v, arrayConstructor));
+ assert(JSValueIsEqual(context, v, arrayConstructor, NULL));
- JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL);
- assert(didInitialize);
- JSStringRef myObjectIString = JSStringCreateWithUTF8CString("MyObject");
- JSObjectSetProperty(context, globalObject, myObjectIString, myObject, kJSPropertyAttributeNone);
- JSStringRelease(myObjectIString);
-
JSStringRef print = JSStringCreateWithUTF8CString("print");
JSObjectRef printFunction = JSObjectMakeFunction(context, print_callAsFunction);
JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone);
function = JSObjectMakeFunctionWithBody(context, functionBody, NULL, 1, NULL);
JSStringRelease(functionBody);
v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
- assert(JSValueIsEqual(context, v, globalObject));
+ assert(JSValueIsEqual(context, v, globalObject, NULL));
v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL);
- assert(JSValueIsEqual(context, v, o));
+ assert(JSValueIsEqual(context, v, o, NULL));
char* scriptUTF8 = createStringWithContentsOfFile("testapi.js");
JSStringRef script = JSStringCreateWithUTF8CString(scriptUTF8);
- result = JSEvaluate(context, script, NULL, NULL, 1, &exception);
+ result = JSEvaluateScript(context, script, NULL, NULL, 1, &exception);
if (JSValueIsUndefined(result))
printf("PASS: Test script executed successfully.\n");
else {
printf("FAIL: Test script returned unexcpected value:\n");
- JSStringRef exceptionIString = JSValueToStringCopy(context, exception);
+ JSStringRef exceptionIString = JSValueToStringCopy(context, exception, NULL);
CFStringRef exceptionCF = JSStringCopyCFString(kCFAllocatorDefault, exceptionIString);
CFShow(exceptionCF);
CFRelease(exceptionCF);
shouldBe("MyObject(0)", 1);
shouldBe("MyObject()", undefined);
shouldBe("typeof new MyObject()", "object");
-shouldBe("MyObject ? 1 : 0", 0); // toBoolean
+shouldBe("MyObject ? 1 : 0", 2); // toBoolean -- should throw 2
shouldBe("+MyObject", 1); // toNumber
shouldBe("(MyObject.toString())", "[object CallbackObject]"); // toString
shouldBe("MyObject - 0", NaN); // toPrimitive
+2006-07-13 Geoffrey Garen <ggaren@apple.com>
+
+ Pleasing to Maciej.
+
+ - Renamed JSEvaluate -> JSEvaluateScript, JSCheckSyntax -> JSCheckScriptSyntax
+ - Added exception out parameters to JSValueTo* and JSValueIsEqual because
+ they can throw
+ - Removed JSObjectGetDescription because it's useless and vague, and
+ JSValueToString/JSValueIsObjectOfClass do a better job, anyway
+ - Clarified comments about "IsFunction/Constructor" to indicate that they
+ are true of all functions/constructors, not just those created by JSObjectMake*
+
2006-07-12 Geoffrey Garen <ggaren@apple.com>
RS by Beth.
.objc_class_name_WebScriptObject
.objc_class_name_WebScriptObjectPrivate
.objc_class_name_WebUndefined
-_JSCheckSyntax
+_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
_JSClassRetain
_JSContextCreate
_JSContextDestroy
_JSContextGetGlobalObject
-_JSEvaluate
+_JSEvaluateScript
_JSGarbageCollect
_JSObjectCallAsConstructor
_JSObjectCallAsFunction
_JSObjectCreatePropertyEnumerator
_JSObjectDeleteProperty
-_JSObjectGetDescription
_JSObjectGetPrivate
_JSObjectGetProperty
_JSObjectGetPrototype