OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 Document* document = currentDocument(); | 91 Document* document = currentDocument(); |
92 ASSERT(document); | 92 ASSERT(document); |
93 | 93 |
94 // Make sure the document is added to the DOM Node map. Otherwise, the TestN
amedConstructor instance | 94 // Make sure the document is added to the DOM Node map. Otherwise, the TestN
amedConstructor instance |
95 // may end up being the only node in the map and get garbage-collected prema
turely. | 95 // may end up being the only node in the map and get garbage-collected prema
turely. |
96 toV8(document, info.Holder(), info.GetIsolate()); | 96 toV8(document, info.Holder(), info.GetIsolate()); |
97 | 97 |
| 98 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestName
dConstructor", info.Holder(), info.GetIsolate()); |
98 if (UNLIKELY(info.Length() < 1)) { | 99 if (UNLIKELY(info.Length() < 1)) { |
99 throwTypeError(ExceptionMessages::failedToExecute("NamedConstructor", "T
estNamedConstructor", ExceptionMessages::notEnoughArguments(1, info.Length())),
info.GetIsolate()); | 100 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 101 exceptionState.throwIfNeeded(); |
100 return; | 102 return; |
101 } | 103 } |
102 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, info[0]); | 104 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, info[0]); |
104 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]); | 105 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]); |
105 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNul
l(info, 2)); | 106 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNul
l(info, 2)); |
106 | 107 |
107 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru
ctor(*document, str1, str2, str3, exceptionState); | 108 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru
ctor(*document, str1, str2, str3, exceptionState); |
108 v8::Handle<v8::Object> wrapper = info.Holder(); | 109 v8::Handle<v8::Object> wrapper = info.Holder(); |
109 if (exceptionState.throwIfNeeded()) | 110 if (exceptionState.throwIfNeeded()) |
110 return; | 111 return; |
111 | 112 |
112 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl.releas
e(), &V8TestNamedConstructorConstructor::wrapperTypeInfo, wrapper, info.GetIsola
te(), WrapperConfiguration::Dependent); | 113 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl.releas
e(), &V8TestNamedConstructorConstructor::wrapperTypeInfo, wrapper, info.GetIsola
te(), WrapperConfiguration::Dependent); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 fromInternalPointer(object)->deref(); | 214 fromInternalPointer(object)->deref(); |
214 } | 215 } |
215 | 216 |
216 template<> | 217 template<> |
217 v8::Handle<v8::Value> toV8NoInline(TestNamedConstructor* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 218 v8::Handle<v8::Value> toV8NoInline(TestNamedConstructor* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
218 { | 219 { |
219 return toV8(impl, creationContext, isolate); | 220 return toV8(impl, creationContext, isolate); |
220 } | 221 } |
221 | 222 |
222 } // namespace WebCore | 223 } // namespace WebCore |
OLD | NEW |