Chromium Code Reviews| Index: Source/bindings/core/v8/custom/V8NodeCustom.cpp |
| diff --git a/Source/bindings/core/v8/custom/V8NodeCustom.cpp b/Source/bindings/core/v8/custom/V8NodeCustom.cpp |
| index ab10930bf62ed71c7789c94a111dd555097dd4e6..80ad75a95086a945f167ca65eb3e56db4ba1d230 100644 |
| --- a/Source/bindings/core/v8/custom/V8NodeCustom.cpp |
| +++ b/Source/bindings/core/v8/custom/V8NodeCustom.cpp |
| @@ -107,16 +107,29 @@ void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& |
| void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| - v8::Handle<v8::Object> holder = info.Holder(); |
| - Node* impl = V8Node::toNative(holder); |
| - |
| - CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| - |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild", "Node", info.Holder(), info.GetIsolate()); |
| - Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
| + if (UNLIKELY(info.Length() < 1)) { |
| + throwMinimumArityTypeErrorForMethod("appendChild", "Node", 1, info.Length(), info.GetIsolate()); |
|
haraken
2014/07/09 01:38:53
Can we make this change in a separate change with
kangil_
2014/07/09 02:53:20
Sure, I will.
|
| + return; |
| + } |
| + Node* impl = V8Node::toNative(info.Holder()); |
| + CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| + Node* newChild; |
| + { |
| + v8::TryCatch block; |
| + V8RethrowTryCatchScope rethrow(block); |
| + if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate())) { |
| + exceptionState.throwTypeError("parameter 1 is not of type 'Node'."); |
| + exceptionState.throwIfNeeded(); |
| + return; |
| + } |
| + TONATIVE_VOID_INTERNAL(newChild, V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0])); |
| + } |
| impl->appendChild(newChild, exceptionState); |
| - if (exceptionState.throwIfNeeded()) |
| + if (exceptionState.hadException()) { |
| + exceptionState.throwIfNeeded(); |
| return; |
| + } |
| v8SetReturnValue(info, info[0]); |
| } |