OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 { | 123 { |
124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
125 TestEventTargetV8Internal::indexedPropertyGetter(index, info); | 125 TestEventTargetV8Internal::indexedPropertyGetter(index, info); |
126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
127 } | 127 } |
128 | 128 |
129 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 129 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
130 { | 130 { |
131 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 131 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
132 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI
solate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); | 132 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI
solate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 133 if (!isUndefinedOrNull(jsValue) && !V8Node::hasInstance(jsValue, info.GetIso
late())) { |
| 134 exceptionState.throwTypeError("The provided value is not of type 'Node'.
"); |
| 135 exceptionState.throwIfNeeded(); |
| 136 return; |
| 137 } |
133 bool result = collection->anonymousIndexedSetter(index, propertyValue); | 138 bool result = collection->anonymousIndexedSetter(index, propertyValue); |
134 if (!result) | 139 if (!result) |
135 return; | 140 return; |
136 v8SetReturnValue(info, jsValue); | 141 v8SetReturnValue(info, jsValue); |
137 } | 142 } |
138 | 143 |
139 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 144 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
140 { | 145 { |
141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 146 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
142 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); | 147 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 { | 194 { |
190 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 195 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
191 return; | 196 return; |
192 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 197 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
193 return; | 198 return; |
194 if (info.Holder()->HasRealNamedProperty(name)) | 199 if (info.Holder()->HasRealNamedProperty(name)) |
195 return; | 200 return; |
196 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 201 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
197 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 202 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
198 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 203 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
199 bool result; | 204 bool result = collection->anonymousNamedSetter(propertyName, propertyValue); |
200 if (jsValue->IsUndefined()) | |
201 result = collection->anonymousNamedSetterUndefined(propertyName); | |
202 else | |
203 result = collection->anonymousNamedSetter(propertyName, propertyValue); | |
204 if (!result) | 205 if (!result) |
205 return; | 206 return; |
206 v8SetReturnValue(info, jsValue); | 207 v8SetReturnValue(info, jsValue); |
207 } | 208 } |
208 | 209 |
209 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 210 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
210 { | 211 { |
211 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 212 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
212 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); | 213 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); |
213 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 214 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 fromInternalPointer(object)->deref(); | 348 fromInternalPointer(object)->deref(); |
348 } | 349 } |
349 | 350 |
350 template<> | 351 template<> |
351 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 352 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
352 { | 353 { |
353 return toV8(impl, creationContext, isolate); | 354 return toV8(impl, creationContext, isolate); |
354 } | 355 } |
355 | 356 |
356 } // namespace WebCore | 357 } // namespace WebCore |
OLD | NEW |