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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild ", "Node", info.Holder(), info.GetIsolate()); | 100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild ", "Node", info.Holder(), info.GetIsolate()); |
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()); | |
111 if (info.Length() > 0 && !info[0]->IsObject()) { | |
112 exceptionState.throwTypeError("parameter 1 ('newChild') is not an object ."); | |
113 exceptionState.throwIfNeeded(); | |
114 return; | |
haraken
2014/07/08 14:59:01
Can you refer to the generated code for [TypeCheck
kangil_
2014/07/09 01:34:17
Done.
| |
115 } | |
116 | |
110 v8::Handle<v8::Object> holder = info.Holder(); | 117 v8::Handle<v8::Object> holder = info.Holder(); |
111 Node* impl = V8Node::toNative(holder); | 118 Node* impl = V8Node::toNative(holder); |
112 | 119 |
113 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 120 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
114 | 121 |
115 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild ", "Node", info.Holder(), info.GetIsolate()); | |
116 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 122 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
117 impl->appendChild(newChild, exceptionState); | 123 impl->appendChild(newChild, exceptionState); |
118 if (exceptionState.throwIfNeeded()) | 124 if (exceptionState.throwIfNeeded()) |
119 return; | 125 return; |
120 v8SetReturnValue(info, info[0]); | 126 v8SetReturnValue(info, info[0]); |
121 } | 127 } |
122 | 128 |
123 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 129 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
124 { | 130 { |
125 ASSERT(impl); | 131 ASSERT(impl); |
(...skipping 21 matching lines...) Expand all Loading... | |
147 return wrap(toDocumentType(impl), creationContext, isolate); | 153 return wrap(toDocumentType(impl), creationContext, isolate); |
148 case Node::DOCUMENT_FRAGMENT_NODE: | 154 case Node::DOCUMENT_FRAGMENT_NODE: |
149 if (impl->isShadowRoot()) | 155 if (impl->isShadowRoot()) |
150 return wrap(toShadowRoot(impl), creationContext, isolate); | 156 return wrap(toShadowRoot(impl), creationContext, isolate); |
151 return wrap(toDocumentFragment(impl), creationContext, isolate); | 157 return wrap(toDocumentFragment(impl), creationContext, isolate); |
152 } | 158 } |
153 ASSERT_NOT_REACHED(); | 159 ASSERT_NOT_REACHED(); |
154 return V8Node::createWrapper(impl, creationContext, isolate); | 160 return V8Node::createWrapper(impl, creationContext, isolate); |
155 } | 161 } |
156 } // namespace WebCore | 162 } // namespace WebCore |
OLD | NEW |