OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 if (object->IsNumber()) | 55 if (object->IsNumber()) |
56 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); | 56 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); |
57 else if (object->IsBoolean()) | 57 else if (object->IsBoolean()) |
58 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); | 58 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); |
59 else if (object->IsNull()) | 59 else if (object->IsNull()) |
60 NULL_TO_NPVARIANT(*result); | 60 NULL_TO_NPVARIANT(*result); |
61 else if (object->IsUndefined()) | 61 else if (object->IsUndefined()) |
62 VOID_TO_NPVARIANT(*result); | 62 VOID_TO_NPVARIANT(*result); |
63 else if (object->IsString()) { | 63 else if (object->IsString()) { |
64 v8::Handle<v8::String> str = object->ToString(); | 64 v8::Handle<v8::String> str = object.As<v8::String>(); |
65 int length = str->Utf8Length() + 1; | 65 int length = str->Utf8Length() + 1; |
66 char* utf8Chars = reinterpret_cast<char*>(malloc(length)); | 66 char* utf8Chars = reinterpret_cast<char*>(malloc(length)); |
67 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT
ED); | 67 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT
ED); |
68 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); | 68 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); |
69 } else if (object->IsObject()) { | 69 } else if (object->IsObject()) { |
70 DOMWindow* window = toDOMWindow(v8::Context::GetCurrent()); | 70 DOMWindow* window = toDOMWindow(v8::Context::GetCurrent()); |
71 NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::C
ast(object), window); | 71 NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::C
ast(object), window); |
72 if (npobject) | 72 if (npobject) |
73 _NPN_RegisterObject(npobject, owner); | 73 _NPN_RegisterObject(npobject, owner); |
74 OBJECT_TO_NPVARIANT(npobject, *result); | 74 OBJECT_TO_NPVARIANT(npobject, *result); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 ExceptionCatcher::~ExceptionCatcher() | 160 ExceptionCatcher::~ExceptionCatcher() |
161 { | 161 { |
162 if (!m_tryCatch.HasCaught()) | 162 if (!m_tryCatch.HasCaught()) |
163 return; | 163 return; |
164 | 164 |
165 if (topHandler) | 165 if (topHandler) |
166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); | 166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); |
167 } | 167 } |
168 | 168 |
169 } // namespace WebCore | 169 } // namespace WebCore |
OLD | NEW |