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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, info[0]); | 109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, info[0]); |
110 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); | 110 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); |
111 v8::Handle<v8::Object> wrapper = info.Holder(); | 111 v8::Handle<v8::Object> wrapper = info.Holder(); |
112 | 112 |
113 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); | 113 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); |
114 v8SetReturnValue(info, wrapper); | 114 v8SetReturnValue(info, wrapper); |
115 } | 115 } |
116 | 116 |
117 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 117 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
118 { | 118 { |
| 119 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestOver
loadedConstructors", info.Holder(), info.GetIsolate()); |
119 if (((info.Length() == 1) && (V8ArrayBuffer::hasInstance(info[0], info.GetIs
olate(), worldType(info.GetIsolate()))))) { | 120 if (((info.Length() == 1) && (V8ArrayBuffer::hasInstance(info[0], info.GetIs
olate(), worldType(info.GetIsolate()))))) { |
120 TestOverloadedConstructorsV8Internal::constructor1(info); | 121 TestOverloadedConstructorsV8Internal::constructor1(info); |
121 return; | 122 return; |
122 } | 123 } |
123 if (((info.Length() == 1) && (V8ArrayBufferView::hasInstance(info[0], info.G
etIsolate(), worldType(info.GetIsolate()))))) { | 124 if (((info.Length() == 1) && (V8ArrayBufferView::hasInstance(info[0], info.G
etIsolate(), worldType(info.GetIsolate()))))) { |
124 TestOverloadedConstructorsV8Internal::constructor2(info); | 125 TestOverloadedConstructorsV8Internal::constructor2(info); |
125 return; | 126 return; |
126 } | 127 } |
127 if (((info.Length() == 1) && (V8Blob::hasInstance(info[0], info.GetIsolate()
, worldType(info.GetIsolate()))))) { | 128 if (((info.Length() == 1) && (V8Blob::hasInstance(info[0], info.GetIsolate()
, worldType(info.GetIsolate()))))) { |
128 TestOverloadedConstructorsV8Internal::constructor3(info); | 129 TestOverloadedConstructorsV8Internal::constructor3(info); |
129 return; | 130 return; |
130 } | 131 } |
131 if (((info.Length() == 1))) { | 132 if (((info.Length() == 1))) { |
132 TestOverloadedConstructorsV8Internal::constructor4(info); | 133 TestOverloadedConstructorsV8Internal::constructor4(info); |
133 return; | 134 return; |
134 } | 135 } |
135 if (UNLIKELY(info.Length() < 1)) { | 136 if (UNLIKELY(info.Length() < 1)) { |
136 throwTypeError(ExceptionMessages::failedToConstruct("TestOverloadedConst
ructors", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol
ate()); | 137 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 138 exceptionState.throwIfNeeded(); |
137 return; | 139 return; |
138 } | 140 } |
139 throwTypeError(ExceptionMessages::failedToConstruct("TestOverloadedConstruct
ors", "No matching constructor signature."), info.GetIsolate()); | 141 exceptionState.throwTypeError("No matching constructor signature."); |
140 return; | 142 exceptionState.throwIfNeeded(); |
141 } | 143 } |
142 | 144 |
143 } // namespace TestOverloadedConstructorsV8Internal | 145 } // namespace TestOverloadedConstructorsV8Internal |
144 | 146 |
145 void V8TestOverloadedConstructors::constructorCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 147 void V8TestOverloadedConstructors::constructorCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
146 { | 148 { |
147 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); | 149 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); |
148 if (!info.IsConstructCall()) { | 150 if (!info.IsConstructCall()) { |
149 throwTypeError(ExceptionMessages::failedToConstruct("TestOverloadedConst
ructors", "Please use the 'new' operator, this DOM object constructor cannot be
called as a function."), info.GetIsolate()); | 151 throwTypeError(ExceptionMessages::failedToConstruct("TestOverloadedConst
ructors", "Please use the 'new' operator, this DOM object constructor cannot be
called as a function."), info.GetIsolate()); |
150 return; | 152 return; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 fromInternalPointer(object)->deref(); | 235 fromInternalPointer(object)->deref(); |
234 } | 236 } |
235 | 237 |
236 template<> | 238 template<> |
237 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 239 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
238 { | 240 { |
239 return toV8(impl, creationContext, isolate); | 241 return toV8(impl, creationContext, isolate); |
240 } | 242 } |
241 | 243 |
242 } // namespace WebCore | 244 } // namespace WebCore |
OLD | NEW |