Index: Source/WebCore/bindings/v8/V8NPUtils.cpp |
=================================================================== |
--- Source/WebCore/bindings/v8/V8NPUtils.cpp (revision 111474) |
+++ Source/WebCore/bindings/v8/V8NPUtils.cpp (working copy) |
@@ -62,11 +62,11 @@ |
else if (object->IsUndefined()) |
VOID_TO_NPVARIANT(*result); |
else if (object->IsString()) { |
- v8::Handle<v8::String> str = object->ToString(); |
- int length = str->Utf8Length() + 1; |
+ v8::String::Utf8Value utf8(object); |
+ int length = utf8.length() + 1; |
char* utf8Chars = reinterpret_cast<char*>(malloc(length)); |
- str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECTED); |
- STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); |
+ memcpy(utf8Chars, *utf8, length); |
+ STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result); |
} else if (object->IsObject()) { |
DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext()); |
NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window); |