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

Side by Side Diff: Source/bindings/tests/results/V8TestEventTarget.cpp

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased onto df9a982fbe97 Created 7 years, 1 month 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
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info) 143 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info)
144 { 144 {
145 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 145 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
146 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); 146 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info);
147 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 147 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
148 } 148 }
149 149
150 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 150 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
151 { 151 {
152 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 152 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
153 ExceptionState exceptionState(info.GetIsolate()); 153 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
154 bool result = collection->anonymousIndexedDeleter(index, exceptionState); 154 bool result = collection->anonymousIndexedDeleter(index, exceptionState);
155 if (exceptionState.throwIfNeeded()) 155 if (exceptionState.throwIfNeeded())
156 return; 156 return;
157 return v8SetReturnValueBool(info, result); 157 return v8SetReturnValueBool(info, result);
158 } 158 }
159 159
160 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 160 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
161 { 161 {
162 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 162 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
163 TestEventTargetV8Internal::indexedPropertyDeleter(index, info); 163 TestEventTargetV8Internal::indexedPropertyDeleter(index, info);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info) 228 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
229 { 229 {
230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
231 TestEventTargetV8Internal::namedPropertyDeleter(name, info); 231 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
233 } 233 }
234 234
235 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 235 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
236 { 236 {
237 ExceptionState exceptionState(info.GetIsolate()); 237 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
238 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 238 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
239 Vector<String> names; 239 Vector<String> names;
240 collection->namedPropertyEnumerator(names, exceptionState); 240 collection->namedPropertyEnumerator(names, exceptionState);
241 if (exceptionState.throwIfNeeded()) 241 if (exceptionState.throwIfNeeded())
242 return; 242 return;
243 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); 243 v8::Handle<v8::Array> v8names = v8::Array::New(names.size());
244 for (size_t i = 0; i < names.size(); ++i) 244 for (size_t i = 0; i < names.size(); ++i)
245 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], info.GetIsolate())); 245 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], info.GetIsolate()));
246 v8SetReturnValue(info, v8names); 246 v8SetReturnValue(info, v8names);
247 } 247 }
248 248
249 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 249 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
250 { 250 {
251 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 251 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
252 AtomicString propertyName = toWebCoreAtomicString(name); 252 AtomicString propertyName = toWebCoreAtomicString(name);
253 ExceptionState exceptionState(info.GetIsolate()); 253 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
254 bool result = collection->namedPropertyQuery(propertyName, exceptionState); 254 bool result = collection->namedPropertyQuery(propertyName, exceptionState);
255 if (exceptionState.throwIfNeeded()) 255 if (exceptionState.throwIfNeeded())
256 return; 256 return;
257 if (!result) 257 if (!result)
258 return; 258 return;
259 v8SetReturnValueInt(info, v8::None); 259 v8SetReturnValueInt(info, v8::None);
260 } 260 }
261 261
262 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 262 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
263 { 263 {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 V8DOMWrapper::associateObjectWithWrapper<V8TestEventTarget>(impl, &wrapperTy peInfo, wrapper, isolate, WrapperConfiguration::Independent); 354 V8DOMWrapper::associateObjectWithWrapper<V8TestEventTarget>(impl, &wrapperTy peInfo, wrapper, isolate, WrapperConfiguration::Independent);
355 return wrapper; 355 return wrapper;
356 } 356 }
357 357
358 void V8TestEventTarget::derefObject(void* object) 358 void V8TestEventTarget::derefObject(void* object)
359 { 359 {
360 fromInternalPointer(object)->deref(); 360 fromInternalPointer(object)->deref();
361 } 361 }
362 362
363 } // namespace WebCore 363 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestActiveDOMObject.cpp ('k') | Source/bindings/tests/results/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698