OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 101 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
102 impl->removeChild(oldChild, exceptionState); | 102 impl->removeChild(oldChild, exceptionState); |
103 if (exceptionState.throwIfNeeded()) | 103 if (exceptionState.throwIfNeeded()) |
104 return; | 104 return; |
105 v8SetReturnValue(info, info[0]); | 105 v8SetReturnValue(info, info[0]); |
106 } | 106 } |
107 | 107 |
108 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 108 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
109 { | 109 { |
110 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild
", "Node", info.Holder(), info.GetIsolate()); | 110 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild
", "Node", info.Holder(), info.GetIsolate()); |
| 111 if (UNLIKELY(info.Length() < 1)) { |
| 112 throwMinimumArityTypeErrorForMethod("appendChild", "Node", 1, info.Lengt
h(), info.GetIsolate()); |
| 113 return; |
| 114 } |
111 Node* impl = V8Node::toNative(info.Holder()); | 115 Node* impl = V8Node::toNative(info.Holder()); |
112 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 116 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
113 Node* newChild; | 117 Node* newChild; |
114 { | 118 { |
115 v8::TryCatch block; | 119 v8::TryCatch block; |
116 V8RethrowTryCatchScope rethrow(block); | 120 V8RethrowTryCatchScope rethrow(block); |
117 if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate()
)) { | 121 if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate()
)) { |
118 exceptionState.throwTypeError("parameter 1 is not of type 'Node'."); | 122 exceptionState.throwTypeError("parameter 1 is not of type 'Node'."); |
119 exceptionState.throwIfNeeded(); | 123 exceptionState.throwIfNeeded(); |
120 return; | 124 return; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return wrap(toDocumentType(impl), creationContext, isolate); | 160 return wrap(toDocumentType(impl), creationContext, isolate); |
157 case Node::DOCUMENT_FRAGMENT_NODE: | 161 case Node::DOCUMENT_FRAGMENT_NODE: |
158 if (impl->isShadowRoot()) | 162 if (impl->isShadowRoot()) |
159 return wrap(toShadowRoot(impl), creationContext, isolate); | 163 return wrap(toShadowRoot(impl), creationContext, isolate); |
160 return wrap(toDocumentFragment(impl), creationContext, isolate); | 164 return wrap(toDocumentFragment(impl), creationContext, isolate); |
161 } | 165 } |
162 ASSERT_NOT_REACHED(); | 166 ASSERT_NOT_REACHED(); |
163 return V8Node::createWrapper(impl, creationContext, isolate); | 167 return V8Node::createWrapper(impl, creationContext, isolate); |
164 } | 168 } |
165 } // namespace WebCore | 169 } // namespace WebCore |
OLD | NEW |