Title: [97767] trunk/Source/_javascript_Core
Revision
97767
Author
[email protected]
Date
2011-10-18 10:03:55 -0700 (Tue, 18 Oct 2011)

Log Message

Indexed arguments on the Arguments object should be enumerable.
https://bugs.webkit.org/show_bug.cgi?id=70302

Reviewed by Sam Weinig.

See ECMA-262 5.1 chapter 10.6 step 11b.
This is visible through a number of means, including Object.keys, Object.getOwnPropertyDescriptor, and operator in.

* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertyDescriptor):
    - The 'enumerable' property should be true for indexed arguments.
(JSC::Arguments::getOwnPropertyNames):
    - Don't guard the adding of indexed properties with 'IncludeDontEnumProperties'.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (97766 => 97767)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-18 16:59:44 UTC (rev 97766)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-18 17:03:55 UTC (rev 97767)
@@ -1,3 +1,19 @@
+2011-10-18  Gavin Barraclough  <[email protected]>
+
+        Indexed arguments on the Arguments object should be enumerable.
+        https://bugs.webkit.org/show_bug.cgi?id=70302
+
+        Reviewed by Sam Weinig.
+
+        See ECMA-262 5.1 chapter 10.6 step 11b.
+        This is visible through a number of means, including Object.keys, Object.getOwnPropertyDescriptor, and operator in.
+
+        * runtime/Arguments.cpp:
+        (JSC::Arguments::getOwnPropertyDescriptor):
+            - The 'enumerable' property should be true for indexed arguments.
+        (JSC::Arguments::getOwnPropertyNames):
+            - Don't guard the adding of indexed properties with 'IncludeDontEnumProperties'.
+
 2011-10-18  Gustavo Noronha Silva  <[email protected]>
 
         Fix distcheck.

Modified: trunk/Source/_javascript_Core/runtime/Arguments.cpp (97766 => 97767)


--- trunk/Source/_javascript_Core/runtime/Arguments.cpp	2011-10-18 16:59:44 UTC (rev 97766)
+++ trunk/Source/_javascript_Core/runtime/Arguments.cpp	2011-10-18 17:03:55 UTC (rev 97767)
@@ -231,9 +231,9 @@
     unsigned i = propertyName.toArrayIndex(isArrayIndex);
     if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
         if (i < d->numParameters) {
-            descriptor.setDescriptor(d->registers[d->firstParameterIndex + i].get(), DontEnum);
+            descriptor.setDescriptor(d->registers[d->firstParameterIndex + i].get(), None);
         } else
-            descriptor.setDescriptor(d->extraArguments[i - d->numParameters].get(), DontEnum);
+            descriptor.setDescriptor(d->extraArguments[i - d->numParameters].get(), None);
         return true;
     }
     
@@ -258,11 +258,11 @@
 
 void Arguments::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
+    for (unsigned i = 0; i < d->numArguments; ++i) {
+        if (!d->deletedArguments || !d->deletedArguments[i])
+            propertyNames.add(Identifier(exec, UString::number(i)));
+    }
     if (mode == IncludeDontEnumProperties) {
-        for (unsigned i = 0; i < d->numArguments; ++i) {
-            if (!d->deletedArguments || !d->deletedArguments[i])
-                propertyNames.add(Identifier(exec, UString::number(i)));
-        }
         propertyNames.add(exec->propertyNames().callee);
         propertyNames.add(exec->propertyNames().length);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to