[JSC] fix RETURN_IF_EXCEPTION() placement in ownPropertyKeys()
authorcaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 17:41:18 +0000 (17:41 +0000)
committercaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 17:41:18 +0000 (17:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171330

Reviewed by Mark Lam.

Ensure RETURN_IF_EXCEPTION() following invokation of the
filterPropertyIfNeeded() lambda.

* runtime/ObjectConstructor.cpp:
(JSC::ownPropertyKeys):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215810 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ObjectConstructor.cpp

index a180e05..0e84c56 100644 (file)
@@ -1,5 +1,18 @@
 2017-04-26  Caitlin Potter  <caitp@igalia.com>
 
+        [JSC] fix RETURN_IF_EXCEPTION() placement in ownPropertyKeys()
+        https://bugs.webkit.org/show_bug.cgi?id=171330
+
+        Reviewed by Mark Lam.
+
+        Ensure RETURN_IF_EXCEPTION() following invokation of the
+        filterPropertyIfNeeded() lambda.
+
+        * runtime/ObjectConstructor.cpp:
+        (JSC::ownPropertyKeys):
+
+2017-04-26  Caitlin Potter  <caitp@igalia.com>
+
         [JSC] Object.keys() must discard property names with no PropertyDescriptor
         https://bugs.webkit.org/show_bug.cgi?id=171291
 
index befda4e..00884f2 100644 (file)
@@ -748,10 +748,9 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro
         for (size_t i = 0; i < numProperties; i++) {
             const auto& identifier = properties[i];
             ASSERT(!identifier.isSymbol());
-            if (filterPropertyIfNeeded(identifier)) {
+            if (filterPropertyIfNeeded(identifier))
                 keys->push(exec, jsOwnedString(exec, identifier.string()));
-                RETURN_IF_EXCEPTION(scope, nullptr);
-            }
+            RETURN_IF_EXCEPTION(scope, nullptr);
         }
         break;
     }
@@ -761,8 +760,9 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro
         for (size_t i = 0; i < numProperties; i++) {
             const auto& identifier = properties[i];
             ASSERT(identifier.isSymbol());
-            if (!vm.propertyNames->isPrivateName(identifier) && filterPropertyIfNeeded(identifier)) {
-                keys->push(exec, Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl())));
+            if (!vm.propertyNames->isPrivateName(identifier)) {
+                if (filterPropertyIfNeeded(identifier))
+                    keys->push(exec, Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl())));
                 RETURN_IF_EXCEPTION(scope, nullptr);
             }
         }
@@ -777,18 +777,18 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro
             if (identifier.isSymbol()) {
                 if (!vm.propertyNames->isPrivateName(identifier))
                     propertySymbols.append(identifier);
-            } else if (filterPropertyIfNeeded(identifier)) {
-                keys->push(exec, jsOwnedString(exec, identifier.string()));
+            } else {
+                if (filterPropertyIfNeeded(identifier))
+                    keys->push(exec, jsOwnedString(exec, identifier.string()));
                 RETURN_IF_EXCEPTION(scope, nullptr);
             }
         }
 
         // To ensure the order defined in the spec (9.1.12), we append symbols at the last elements of keys.
         for (const auto& identifier : propertySymbols) {
-            if (filterPropertyIfNeeded(identifier)) {
+            if (filterPropertyIfNeeded(identifier))
                 keys->push(exec, Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl())));
-                RETURN_IF_EXCEPTION(scope, nullptr);
-            }
+            RETURN_IF_EXCEPTION(scope, nullptr);
         }
 
         break;