Title: [183320] trunk
Revision
183320
Author
[email protected]
Date
2015-04-25 18:08:59 -0700 (Sat, 25 Apr 2015)

Log Message

Set#keys !== Set#values
https://bugs.webkit.org/show_bug.cgi?id=144190

Patch by Jordan Harband <[email protected]> on 2015-04-25
Reviewed by Darin Adler.

Source/_javascript_Core:

per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.keys
Set#keys should === Set#values

* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):
(JSC::setProtoFuncValues):
(JSC::setProtoFuncEntries):
(JSC::setProtoFuncKeys): Deleted.

LayoutTests:

* js/script-tests/set-keys.js: Added.
* js/set-keys-expected.txt: Added.
* js/set-keys.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (183319 => 183320)


--- trunk/LayoutTests/ChangeLog	2015-04-26 01:06:59 UTC (rev 183319)
+++ trunk/LayoutTests/ChangeLog	2015-04-26 01:08:59 UTC (rev 183320)
@@ -1,3 +1,14 @@
+2015-04-25  Jordan Harband  <[email protected]>
+
+        Set#keys !== Set#values
+        https://bugs.webkit.org/show_bug.cgi?id=144190
+
+        Reviewed by Darin Adler.
+
+        * js/script-tests/set-keys.js: Added.
+        * js/set-keys-expected.txt: Added.
+        * js/set-keys.html: Added.
+
 2015-04-25  Darin Adler  <[email protected]>
 
         Crash if IDBTransaction is aborted right after it's created

Added: trunk/LayoutTests/js/script-tests/set-keys.js (0 => 183320)


--- trunk/LayoutTests/js/script-tests/set-keys.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/set-keys.js	2015-04-26 01:08:59 UTC (rev 183320)
@@ -0,0 +1,4 @@
+description("Tests basic correctness of ES Set's keys() API");
+
+shouldBe("Set.prototype.keys.length", "0");
+shouldBeTrue("Set.prototype.keys === Set.prototype.values");

Added: trunk/LayoutTests/js/set-keys-expected.txt (0 => 183320)


--- trunk/LayoutTests/js/set-keys-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/set-keys-expected.txt	2015-04-26 01:08:59 UTC (rev 183320)
@@ -0,0 +1,11 @@
+Tests basic correctness of ES Set's keys() API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Set.prototype.keys.length is 0
+PASS Set.prototype.keys === Set.prototype.values is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/set-keys.html (0 => 183320)


--- trunk/LayoutTests/js/set-keys.html	                        (rev 0)
+++ trunk/LayoutTests/js/set-keys.html	2015-04-26 01:08:59 UTC (rev 183320)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (183319 => 183320)


--- trunk/Source/_javascript_Core/ChangeLog	2015-04-26 01:06:59 UTC (rev 183319)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-04-26 01:08:59 UTC (rev 183320)
@@ -1,3 +1,19 @@
+2015-04-25  Jordan Harband  <[email protected]>
+
+        Set#keys !== Set#values
+        https://bugs.webkit.org/show_bug.cgi?id=144190
+
+        Reviewed by Darin Adler.
+
+        per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.keys
+        Set#keys should === Set#values
+
+        * runtime/SetPrototype.cpp:
+        (JSC::SetPrototype::finishCreation):
+        (JSC::setProtoFuncValues):
+        (JSC::setProtoFuncEntries):
+        (JSC::setProtoFuncKeys): Deleted.
+
 2015-04-25  Joseph Pecoraro  <[email protected]>
 
         Allow for pausing a JSContext when opening a Web Inspector

Modified: trunk/Source/_javascript_Core/runtime/SetPrototype.cpp (183319 => 183320)


--- trunk/Source/_javascript_Core/runtime/SetPrototype.cpp	2015-04-26 01:06:59 UTC (rev 183319)
+++ trunk/Source/_javascript_Core/runtime/SetPrototype.cpp	2015-04-26 01:08:59 UTC (rev 183320)
@@ -46,7 +46,6 @@
 static EncodedJSValue JSC_HOST_CALL setProtoFuncDelete(ExecState*);
 static EncodedJSValue JSC_HOST_CALL setProtoFuncForEach(ExecState*);
 static EncodedJSValue JSC_HOST_CALL setProtoFuncHas(ExecState*);
-static EncodedJSValue JSC_HOST_CALL setProtoFuncKeys(ExecState*);
 static EncodedJSValue JSC_HOST_CALL setProtoFuncValues(ExecState*);
 static EncodedJSValue JSC_HOST_CALL setProtoFuncEntries(ExecState*);
 
@@ -64,11 +63,11 @@
     JSC_NATIVE_FUNCTION(vm.propertyNames->deleteKeyword, setProtoFuncDelete, DontEnum, 1);
     JSC_NATIVE_FUNCTION(vm.propertyNames->forEach, setProtoFuncForEach, DontEnum, 1);
     JSC_NATIVE_FUNCTION(vm.propertyNames->has, setProtoFuncHas, DontEnum, 1);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->keys, setProtoFuncKeys, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->entries, setProtoFuncEntries, DontEnum, 0);
 
     JSFunction* values = JSFunction::create(vm, globalObject, 0, vm.propertyNames->values.string(), setProtoFuncValues);
     putDirectWithoutTransition(vm, vm.propertyNames->values, values, DontEnum);
+    putDirectWithoutTransition(vm, vm.propertyNames->keys, values, DontEnum);
     putDirectWithoutTransition(vm, vm.propertyNames->iteratorSymbol, values, DontEnum);
 
     GetterSetter* accessor = GetterSetter::create(vm, globalObject);
@@ -172,7 +171,7 @@
 {
     JSSet* thisObj = jsDynamicCast<JSSet*>(callFrame->thisValue());
     if (!thisObj)
-        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map value iterator for a non-Map object.")));
+        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Set value iterator for a non-Set object.")));
     return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, SetIterateValue));
 }
 
@@ -180,16 +179,8 @@
 {
     JSSet* thisObj = jsDynamicCast<JSSet*>(callFrame->thisValue());
     if (!thisObj)
-        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map key iterator for a non-Map object.")));
+        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Set key iterator for a non-Set object.")));
     return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, SetIterateKeyValue));
 }
 
-EncodedJSValue JSC_HOST_CALL setProtoFuncKeys(CallFrame* callFrame)
-{
-    JSSet* thisObj = jsDynamicCast<JSSet*>(callFrame->thisValue());
-    if (!thisObj)
-        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map entry iterator for a non-Map object.")));
-    return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, SetIterateKey));
 }
-
-}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to