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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } else if (object->IsUndefined()) { | 63 } else if (object->IsUndefined()) { |
64 VOID_TO_NPVARIANT(*result); | 64 VOID_TO_NPVARIANT(*result); |
65 } else if (object->IsString()) { | 65 } else if (object->IsString()) { |
66 v8::Handle<v8::String> str = object.As<v8::String>(); | 66 v8::Handle<v8::String> str = object.As<v8::String>(); |
67 int length = str->Utf8Length() + 1; | 67 int length = str->Utf8Length() + 1; |
68 char* utf8Chars = reinterpret_cast<char*>(malloc(length)); | 68 char* utf8Chars = reinterpret_cast<char*>(malloc(length)); |
69 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT
ED); | 69 str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECT
ED); |
70 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); | 70 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); |
71 } else if (object->IsObject()) { | 71 } else if (object->IsObject()) { |
72 LocalDOMWindow* window = currentDOMWindow(isolate); | 72 LocalDOMWindow* window = currentDOMWindow(isolate); |
73 NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::C
ast(object), window, isolate); | 73 NPObject* npobject = npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::O
bject>::Cast(object), window); |
74 if (npobject) | 74 if (npobject) |
75 _NPN_RegisterObject(npobject, owner); | 75 _NPN_RegisterObject(npobject, owner); |
76 OBJECT_TO_NPVARIANT(npobject, *result); | 76 OBJECT_TO_NPVARIANT(npobject, *result); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj
ect* owner, v8::Isolate* isolate) | 80 v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj
ect* owner, v8::Isolate* isolate) |
81 { | 81 { |
82 NPVariantType type = variant->type; | 82 NPVariantType type = variant->type; |
83 | 83 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ExceptionCatcher::~ExceptionCatcher() | 162 ExceptionCatcher::~ExceptionCatcher() |
163 { | 163 { |
164 if (!m_tryCatch.HasCaught()) | 164 if (!m_tryCatch.HasCaught()) |
165 return; | 165 return; |
166 | 166 |
167 if (topHandler) | 167 if (topHandler) |
168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); | 168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |