String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object) { ASSERT(!object->IsString()); if (object->IsInt32()) return int32ToWebCoreString(object->Int32Value()); v8::TryCatch block; v8::Handle<v8::String> v8String = object->ToString(); // Handle the case where an exception is thrown as part of invoking toString on the object. if (block.HasCaught()) { throwError(block.Exception()); return StringImpl::empty(); } return v8StringToWebCoreString<String>(v8String, DoNotExternalize); }
static String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object) { ASSERT(!object->IsString()); if (object->IsInt32()) return int32ToWebCoreString(object->Int32Value()); v8::TryCatch block; v8::Handle<v8::String> v8String = object->ToString(); // Handle the case where an exception is thrown as part of invoking toString on the object. if (block.HasCaught()) { throwError(block.Exception()); return StringImpl::empty(); } // This path is unexpected. However there is hypothesis that it // might be combination of v8 and v8 bindings bugs. For now // just bailout as we'll crash if attempt to convert empty handle into a string. if (v8String.IsEmpty()) { ASSERT_NOT_REACHED(); return StringImpl::empty(); } return v8StringToWebCoreString<String>(v8String, DoNotExternalize); }