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

Side by Side Diff: Source/bindings/v8/custom/V8NodeCustom.cpp

Issue 18398002: Remove IDBNotFoundError ExceptionCode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 #include "V8DocumentType.h" 39 #include "V8DocumentType.h"
40 #include "V8Element.h" 40 #include "V8Element.h"
41 #include "V8Entity.h" 41 #include "V8Entity.h"
42 #include "V8HTMLElement.h" 42 #include "V8HTMLElement.h"
43 #include "V8Node.h" 43 #include "V8Node.h"
44 #include "V8Notation.h" 44 #include "V8Notation.h"
45 #include "V8ProcessingInstruction.h" 45 #include "V8ProcessingInstruction.h"
46 #include "V8SVGElement.h" 46 #include "V8SVGElement.h"
47 #include "V8ShadowRoot.h" 47 #include "V8ShadowRoot.h"
48 #include "V8Text.h" 48 #include "V8Text.h"
49 #include "bindings/v8/ExceptionState.h"
49 #include "bindings/v8/V8AbstractEventListener.h" 50 #include "bindings/v8/V8AbstractEventListener.h"
50 #include "bindings/v8/V8Binding.h" 51 #include "bindings/v8/V8Binding.h"
51 #include "bindings/v8/V8EventListener.h" 52 #include "bindings/v8/V8EventListener.h"
52 #include "core/dom/CustomElementCallbackDispatcher.h" 53 #include "core/dom/CustomElementCallbackDispatcher.h"
53 #include "core/dom/Document.h" 54 #include "core/dom/Document.h"
54 #include "core/dom/EventListener.h" 55 #include "core/dom/EventListener.h"
55 #include "core/dom/shadow/ShadowRoot.h" 56 #include "core/dom/shadow/ShadowRoot.h"
56 #include "wtf/RefPtr.h" 57 #include "wtf/RefPtr.h"
57 58
58 namespace WebCore { 59 namespace WebCore {
59 60
60 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 61 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
61 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 62 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
62 { 63 {
63 v8::Handle<v8::Object> holder = args.Holder(); 64 v8::Handle<v8::Object> holder = args.Holder();
64 Node* imp = V8Node::toNative(holder); 65 Node* imp = V8Node::toNative(holder);
65 66
66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 67 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
67 68
68 ExceptionCode ec = 0; 69 ExceptionState es(args.GetIsolate());
Mike West 2013/07/10 09:40:30 This all looks perfectly reasonable, but doesn't s
arv (Not doing code reviews) 2013/07/10 15:37:24 Done.
69 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 70 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
70 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 71 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
71 imp->insertBefore(newChild, refChild, ec, AttachLazily); 72 imp->insertBefore(newChild, refChild, es, AttachLazily);
72 if (ec) 73 if (es.throwIfNeeded())
73 setDOMException(ec, args.GetIsolate()); 74 return;
74 else 75 v8SetReturnValue(args, args[0]);
75 v8SetReturnValue(args, args[0]);
76 } 76 }
77 77
78 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 78 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
79 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 79 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
80 { 80 {
81 v8::Handle<v8::Object> holder = args.Holder(); 81 v8::Handle<v8::Object> holder = args.Holder();
82 Node* imp = V8Node::toNative(holder); 82 Node* imp = V8Node::toNative(holder);
83 83
84 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 84 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
85 85
86 ExceptionCode ec = 0; 86 ExceptionState es(args.GetIsolate());
87 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 87 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
88 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 88 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
89 imp->replaceChild(newChild, oldChild, ec, AttachLazily); 89 imp->replaceChild(newChild, oldChild, es, AttachLazily);
90 if (ec) 90 if (es.throwIfNeeded())
91 setDOMException(ec, args.GetIsolate()); 91 return;
92 else 92 v8SetReturnValue(args, args[1]);
93 v8SetReturnValue(args, args[1]);
94 } 93 }
95 94
96 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 95 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
97 { 96 {
98 v8::Handle<v8::Object> holder = args.Holder(); 97 v8::Handle<v8::Object> holder = args.Holder();
99 Node* imp = V8Node::toNative(holder); 98 Node* imp = V8Node::toNative(holder);
100 99
101 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 100 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
102 101
103 ExceptionCode ec = 0; 102 ExceptionState es(args.GetIsolate());
104 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 103 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
105 imp->removeChild(oldChild, ec); 104 imp->removeChild(oldChild, es);
106 if (ec) 105 if (es.throwIfNeeded())
107 setDOMException(ec, args.GetIsolate()); 106 return;
108 else 107 v8SetReturnValue(args, args[0]);
109 v8SetReturnValue(args, args[0]);
110 } 108 }
111 109
112 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 110 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
113 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 111 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
114 { 112 {
115 v8::Handle<v8::Object> holder = args.Holder(); 113 v8::Handle<v8::Object> holder = args.Holder();
116 Node* imp = V8Node::toNative(holder); 114 Node* imp = V8Node::toNative(holder);
117 115
118 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 116 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
119 117
120 ExceptionCode ec = 0; 118 ExceptionState es(args.GetIsolate());
121 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 119 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
122 imp->appendChild(newChild, ec, AttachLazily); 120 imp->appendChild(newChild, es, AttachLazily);
123 if (ec) 121 if (es.throwIfNeeded())
124 setDOMException(ec, args.GetIsolate()); 122 return;
125 else 123 v8SetReturnValue(args, args[0]);
126 v8SetReturnValue(args, args[0]);
127 } 124 }
128 125
129 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 126 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
130 { 127 {
131 ASSERT(impl); 128 ASSERT(impl);
132 switch (impl->nodeType()) { 129 switch (impl->nodeType()) {
133 case Node::ELEMENT_NODE: 130 case Node::ELEMENT_NODE:
134 // For performance reasons, this is inlined from V8Element::wrap and mus t remain in sync. 131 // For performance reasons, this is inlined from V8Element::wrap and mus t remain in sync.
135 if (impl->isHTMLElement()) 132 if (impl->isHTMLElement())
136 return wrap(toHTMLElement(impl), creationContext, isolate); 133 return wrap(toHTMLElement(impl), creationContext, isolate);
(...skipping 21 matching lines...) Expand all
158 return wrap(toShadowRoot(impl), creationContext, isolate); 155 return wrap(toShadowRoot(impl), creationContext, isolate);
159 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te); 156 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te);
160 case Node::NOTATION_NODE: 157 case Node::NOTATION_NODE:
161 return wrap(static_cast<Notation*>(impl), creationContext, isolate); 158 return wrap(static_cast<Notation*>(impl), creationContext, isolate);
162 default: 159 default:
163 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE 160 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE
164 } 161 }
165 return V8Node::createWrapper(impl, creationContext, isolate); 162 return V8Node::createWrapper(impl, creationContext, isolate);
166 } 163 }
167 } // namespace WebCore 164 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698