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

Side by Side Diff: Source/bindings/core/v8/DictionaryHelperForCore.cpp

Issue 555133003: Use ExceptionState to throw exceptions when converting arrays (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess agePortArray& value) 268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess agePortArray& value)
269 { 269 {
270 v8::Local<v8::Value> v8Value; 270 v8::Local<v8::Value> v8Value;
271 if (!dictionary.get(key, v8Value)) 271 if (!dictionary.get(key, v8Value))
272 return false; 272 return false;
273 273
274 ASSERT(dictionary.isolate()); 274 ASSERT(dictionary.isolate());
275 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); 275 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent());
276 if (blink::isUndefinedOrNull(v8Value)) 276 if (blink::isUndefinedOrNull(v8Value))
277 return true; 277 return true;
278 bool success = false; 278 // FIXME (before landing): We can't use a NonThrowableExceptionState here; f igure out what to do instead.
Jens Widell 2014/09/11 13:22:31 Need to resolve this. I thought I couldn't create
279 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), &success); 279 NonThrowableExceptionState exceptionState;
280 return success; 280 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), exceptionState);
281 return !exceptionState.throwIfNeeded();
281 } 282 }
282 283
283 template <> 284 template <>
284 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash Set<AtomicString>& value) 285 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash Set<AtomicString>& value)
285 { 286 {
286 v8::Local<v8::Value> v8Value; 287 v8::Local<v8::Value> v8Value;
287 if (!dictionary.get(key, v8Value)) 288 if (!dictionary.get(key, v8Value))
288 return false; 289 return false;
289 290
290 // FIXME: Support array-like objects 291 // FIXME: Support array-like objects
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 Dictionary::ConversionContextScope scope(context); 654 Dictionary::ConversionContextScope scope(context);
654 655
655 v8::Local<v8::Value> v8Value; 656 v8::Local<v8::Value> v8Value;
656 if (!dictionary.get(key, v8Value)) 657 if (!dictionary.get(key, v8Value))
657 return true; 658 return true;
658 659
659 return DictionaryHelper::get(dictionary, key, value); 660 return DictionaryHelper::get(dictionary, key, value);
660 } 661 }
661 662
662 } // namespace blink 663 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698