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

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: merge 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/Document.h" 53 #include "core/dom/Document.h"
53 #include "core/dom/EventListener.h" 54 #include "core/dom/EventListener.h"
54 #include "core/dom/shadow/ShadowRoot.h" 55 #include "core/dom/shadow/ShadowRoot.h"
55 #include "wtf/RefPtr.h" 56 #include "wtf/RefPtr.h"
56 57
57 namespace WebCore { 58 namespace WebCore {
58 59
59 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 60 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
60 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 61 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
61 { 62 {
62 v8::Handle<v8::Object> holder = args.Holder(); 63 v8::Handle<v8::Object> holder = args.Holder();
63 Node* imp = V8Node::toNative(holder); 64 Node* imp = V8Node::toNative(holder);
64 ExceptionCode ec = 0; 65 ExceptionState es(args.GetIsolate());
65 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 66 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
66 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 67 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
67 bool success = imp->insertBefore(newChild, refChild, ec, AttachLazily); 68 bool success = imp->insertBefore(newChild, refChild, es, AttachLazily);
68 if (ec) { 69 if (es.throwIfNeeded())
69 setDOMException(ec, args.GetIsolate());
70 return; 70 return;
71 }
72 if (success) { 71 if (success) {
73 v8SetReturnValue(args, args[0]); 72 v8SetReturnValue(args, args[0]);
74 return; 73 return;
75 } 74 }
76 v8SetReturnValueNull(args); 75 v8SetReturnValueNull(args);
77 } 76 }
78 77
79 // 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
80 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 79 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
81 { 80 {
82 v8::Handle<v8::Object> holder = args.Holder(); 81 v8::Handle<v8::Object> holder = args.Holder();
83 Node* imp = V8Node::toNative(holder); 82 Node* imp = V8Node::toNative(holder);
84 ExceptionCode ec = 0; 83 ExceptionState es(args.GetIsolate());
85 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 84 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
86 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 85 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
87 bool success = imp->replaceChild(newChild, oldChild, ec, AttachLazily); 86 bool success = imp->replaceChild(newChild, oldChild, es, AttachLazily);
88 if (ec) { 87 if (es.throwIfNeeded())
89 setDOMException(ec, args.GetIsolate());
90 return; 88 return;
91 }
92 if (success) { 89 if (success) {
93 v8SetReturnValue(args, args[1]); 90 v8SetReturnValue(args, args[1]);
94 return; 91 return;
95 } 92 }
96 v8SetReturnValueNull(args); 93 v8SetReturnValueNull(args);
97 } 94 }
98 95
99 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 96 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
100 { 97 {
101 v8::Handle<v8::Object> holder = args.Holder(); 98 v8::Handle<v8::Object> holder = args.Holder();
102 Node* imp = V8Node::toNative(holder); 99 Node* imp = V8Node::toNative(holder);
103 ExceptionCode ec = 0; 100 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 ; 101 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
105 bool success = imp->removeChild(oldChild, ec); 102 bool success = imp->removeChild(oldChild, es);
106 if (ec) { 103 if (es.throwIfNeeded())
107 setDOMException(ec, args.GetIsolate());
108 return; 104 return;
109 }
110 if (success) { 105 if (success) {
111 v8SetReturnValue(args, args[0]); 106 v8SetReturnValue(args, args[0]);
112 return; 107 return;
113 } 108 }
114 v8SetReturnValueNull(args); 109 v8SetReturnValueNull(args);
115 } 110 }
116 111
117 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 112 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
118 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 113 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
119 { 114 {
120 v8::Handle<v8::Object> holder = args.Holder(); 115 v8::Handle<v8::Object> holder = args.Holder();
121 Node* imp = V8Node::toNative(holder); 116 Node* imp = V8Node::toNative(holder);
122 ExceptionCode ec = 0; 117 ExceptionState es(args.GetIsolate());
123 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 118 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
124 bool success = imp->appendChild(newChild, ec, AttachLazily); 119 bool success = imp->appendChild(newChild, es, AttachLazily);
125 if (ec) { 120 if (es.throwIfNeeded())
126 setDOMException(ec, args.GetIsolate());
127 return; 121 return;
128 }
129 if (success) { 122 if (success) {
130 v8SetReturnValue(args, args[0]); 123 v8SetReturnValue(args, args[0]);
131 return; 124 return;
132 } 125 }
133 v8SetReturnValueNull(args); 126 v8SetReturnValueNull(args);
134 } 127 }
135 128
136 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)
137 { 130 {
138 ASSERT(impl); 131 ASSERT(impl);
(...skipping 26 matching lines...) Expand all
165 return wrap(toShadowRoot(impl), creationContext, isolate); 158 return wrap(toShadowRoot(impl), creationContext, isolate);
166 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te); 159 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te);
167 case Node::NOTATION_NODE: 160 case Node::NOTATION_NODE:
168 return wrap(static_cast<Notation*>(impl), creationContext, isolate); 161 return wrap(static_cast<Notation*>(impl), creationContext, isolate);
169 default: 162 default:
170 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE 163 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE
171 } 164 }
172 return V8Node::createWrapper(impl, creationContext, isolate); 165 return V8Node::createWrapper(impl, creationContext, isolate);
173 } 166 }
174 } // namespace WebCore 167 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698