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
+
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));
}
-
-}