Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: Source/bindings/core/v8/custom/V8NodeCustom.cpp

Issue 374093002: Node.appendChild should throw TypeError when newChild is not an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..98f91dfc19b50a755b207c0e7f441a64513eadcf 100644
--- a/Source/bindings/core/v8/custom/V8NodeCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8NodeCustom.cpp
@@ -107,12 +107,18 @@ void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild", "Node", info.Holder(), info.GetIsolate());
+ if (info.Length() > 0 && !info[0]->IsObject()) {
+ exceptionState.throwTypeError("parameter 1 ('newChild') is not an object.");
+ exceptionState.throwIfNeeded();
+ 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.
+ }
+
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]);
impl->appendChild(newChild, exceptionState);
if (exceptionState.throwIfNeeded())
« no previous file with comments | « LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698