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