JSValue jsValue = toJS(exec, value);
if (JSObject* o = jsValue.getObject()) {
- if (o->inherits(&JSCallbackObject<JSGlobalObject>::info))
- return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
- else if (o->inherits(&JSCallbackObject<JSObject>::info))
- return static_cast<JSCallbackObject<JSObject>*>(o)->inherits(jsClass);
+ if (o->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
+ return jsCast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
+ if (o->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
+ return jsCast<JSCallbackObject<JSNonFinalObject>*>(o)->inherits(jsClass);
}
return false;
}
JSObject* jsConstructor = toJS(constructor);
if (!jsConstructor->structure()->typeInfo().implementsHasInstance())
return false;
- bool result = jsConstructor->hasInstance(exec, jsValue, jsConstructor->get(exec, exec->propertyNames().prototype)); // false if an exception is thrown
+ bool result = jsConstructor->methodTable()->hasInstance(jsConstructor, exec, jsValue, jsConstructor->get(exec, exec->propertyNames().prototype)); // false if an exception is thrown
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
// generated internally to JavaScriptCore naturally have that representation,
// but an external NaN might not.
if (isnan(value))
- value = NaN;
+ value = std::numeric_limits<double>::quiet_NaN();
- return toRef(exec, jsNumber(exec, value));
+ return toRef(exec, jsNumber(value));
}
JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string)
{
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
- LiteralParser parser(exec, string->ustring(), LiteralParser::StrictJSON);
+ UString str = string->ustring();
+ if (str.is8Bit()) {
+ LiteralParser<LChar> parser(exec, str.characters8(), str.length(), StrictJSON);
+ return toRef(exec, parser.tryLiteralParse());
+ }
+ LiteralParser<UChar> parser(exec, str.characters16(), str.length(), StrictJSON);
return toRef(exec, parser.tryLiteralParse());
}
exec->clearException();
return 0;
}
- return OpaqueJSString::create(result).releaseRef();
+ return OpaqueJSString::create(result).leakRef();
}
bool JSValueToBoolean(JSContextRef ctx, JSValueRef value)
if (exception)
*exception = toRef(exec, exec->exception());
exec->clearException();
- number = NaN;
+ number = std::numeric_limits<double>::quiet_NaN();
}
return number;
}
JSValue jsValue = toJS(exec, value);
- RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)));
+ RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)->value(exec)));
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
exec->clearException();
stringRef.clear();
}
- return stringRef.release().releaseRef();
+ return stringRef.release().leakRef();
}
JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception)