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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp

Issue 2520273002: binding: Makes Dictionary::hasProperty rethrow an exception. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp
index b7e0b549d0890086718a28386f405d4659c18aee..e7dc68785d7df8de00fdb7d766ddfc488bf01e43 100644
--- a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp
@@ -57,15 +57,20 @@ Dictionary::Dictionary(v8::Isolate* isolate,
"The dictionary provided is neither undefined, null nor an Object.");
}
-bool Dictionary::hasProperty(const StringView& key) const {
+bool Dictionary::hasProperty(const StringView& key,
+ ExceptionState& exceptionState) const {
if (m_dictionaryObject.IsEmpty())
return false;
- // TODO(bashi,yukishiino): Should rethrow the exception.
- // Has() on a revoked proxy will throw an exception.
- // http://crbug.com/666661
- return v8CallBoolean(
- m_dictionaryObject->Has(v8Context(), v8String(m_isolate, key)));
+ v8::TryCatch tryCatch(m_isolate);
+ bool hasKey = false;
+ if (!m_dictionaryObject->Has(v8Context(), v8String(m_isolate, key))
+ .To(&hasKey)) {
+ exceptionState.rethrowV8Exception(tryCatch.Exception());
+ return false;
+ }
+
+ return hasKey;
}
DictionaryIterator Dictionary::getIterator(

Powered by Google App Engine
This is Rietveld 408576698