Diff
Modified: trunk/LayoutTests/ChangeLog (202302 => 202303)
--- trunk/LayoutTests/ChangeLog 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/ChangeLog 2016-06-21 23:24:37 UTC (rev 202303)
@@ -1,5 +1,18 @@
2016-06-21 Jiewen Tan <[email protected]>
+ Unreviewed, rolling out r200619.
+
+ This incompleted feature broke http://m.yahoo.co.jp. Roll it
+ out together with r200678.
+
+ Reverted changeset:
+
+ "NodeList should be iterable"
+ https://bugs.webkit.org/show_bug.cgi?id=131443
+ http://trac.webkit.org/changeset/200619
+
+2016-06-21 Jiewen Tan <[email protected]>
+
Unreviewed, rolling out r200678.
This incompleted feature broke http://m.yahoo.co.jp. Roll it
Modified: trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt (202302 => 202303)
--- trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt 2016-06-21 23:24:37 UTC (rev 202303)
@@ -5,7 +5,7 @@
[object NodeList]
-PASS resultArray.length is 15
+PASS resultArray.length is 11
PASS resultArray[0].i is '0'
PASS resultArray[0].item is nodeList.item(0)
PASS resultArray[1].i is '1'
Deleted: trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt (202302 => 202303)
--- trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt 2016-06-21 23:24:37 UTC (rev 202303)
@@ -1,38 +0,0 @@
-Testing of NodeList iterable capacities.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS nodeList.length is 2
-PASS item is children[index++]
-PASS item is children[index++]
-PASS pair[0] is children[0]
-PASS pair[1] is children[1]
-PASS forEachContainer is nodeList
-FAIL forEachIndex should be 0 (of type number). Was [object HTMLDivElement] (of type object).
-PASS node is children[index++]
-PASS forEachContainer is nodeList
-FAIL forEachIndex should be 1 (of type number). Was [object HTMLOListElement] (of type object).
-PASS node is children[index++]
-PASS iterator.next().value is children[0]
-PASS iterator.next().value is children[1]
-PASS end.done is true
-PASS end.value is undefined
-PASS iterator.next().value is children[0]
-PASS iterator.next().value is children[1]
-PASS end.done is true
-PASS end.value is undefined
-PASS pair.length is 2
-FAIL pair[0] should be 0 (of type number). Was [object HTMLDivElement] (of type object).
-PASS pair[1] is children[0]
-PASS pair.length is 2
-FAIL pair[0] should be 1 (of type number). Was [object HTMLOListElement] (of type object).
-PASS pair[1] is children[1]
-PASS end.done is true
-PASS end.value is undefined
-FAIL end.done should be true. Was false.
-FAIL end.value should be undefined (of type undefined). Was [object HTMLParagraphElement],[object HTMLParagraphElement] (of type object).
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/dom/nodeListIterator.html (202302 => 202303)
--- trunk/LayoutTests/fast/dom/nodeListIterator.html 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/dom/nodeListIterator.html 2016-06-21 23:24:37 UTC (rev 202303)
@@ -1,79 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
- <head>
- <script src=""
- </head>
- <body>
- <script>
- description('Testing of NodeList iterable capacities.');
-
- if (window.testRunner)
- testRunner.dumpAsText();
-
- var end;
- function checkEndIterator(iteratorValue) {
- end = iteratorValue;
- shouldBe('end.done', 'true');
- shouldBe('end.value', 'undefined');
- }
-
- var testingGround = document.createElement('div');
- var children = [document.createElement('div'), document.createElement('ol')];
- testingGround.appendChild(children[0]);
- testingGround.appendChild(children[1]);
- document.body.appendChild(testingGround);
-
- var nodeList = testingGround.childNodes;
-
- shouldBe("nodeList.length", "2");
-
- var index = 0;
- for (var item of nodeList)
- shouldBe('item', 'children[index++]');
-
- pair = Array.from(nodeList);
- shouldBe('pair[0]', 'children[0]');
- shouldBe('pair[1]', 'children[1]');
-
- index = 0;
- var node;
- var forEachIndex;
- var forEachContainer;
- nodeList.forEach(function(n, i, c) {
- node = n;
- forEachIndex = i;
- forEachContainer = c;
- shouldBe('forEachContainer', 'nodeList');
- shouldBe('forEachIndex', 'index');
- shouldBe('node', 'children[index++]');
- });
-
- var iterator = nodeList.keys();
- shouldBe('iterator.next().value', 'children[0]');
- shouldBe('iterator.next().value', 'children[1]');
- checkEndIterator(iterator.next());
-
- var iterator = nodeList.values();
- shouldBe('iterator.next().value', 'children[0]');
- shouldBe('iterator.next().value', 'children[1]');
- checkEndIterator(iterator.next());
-
- var iterator = nodeList.entries();
- var pair = iterator.next().value;
- shouldBe('pair.length', '2');
- shouldBe('pair[0]', '0');
- shouldBe('pair[1]', 'children[0]');
- pair = iterator.next().value;
- shouldBe('pair.length', '2');
- shouldBe('pair[0]', '1');
- shouldBe('pair[1]', 'children[1]');
- checkEndIterator(iterator.next());
-
- testingGround.appendChild(document.createElement('ul'));
- testingGround.appendChild(document.createElement('p'));
- checkEndIterator(iterator.next());
-
- </script>
- <script src=""
- </body>
-</html>
Modified: trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js (202302 => 202303)
--- trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js 2016-06-21 23:24:37 UTC (rev 202303)
@@ -97,7 +97,7 @@
var nodeList = testingGround.childNodes;
resultArray = iterateList(nodeList);
-shouldBe("resultArray.length", "15");
+shouldBe("resultArray.length", "11");
shouldBe("resultArray[0].i", "'0'");
shouldBe("resultArray[0].item", "nodeList.item(0)");
shouldBe("resultArray[1].i", "'1'");
Modified: trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt (202302 => 202303)
--- trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt 2016-06-21 23:24:37 UTC (rev 202303)
@@ -3,11 +3,8 @@
PASS new FontFaceSet([fontFace1]).size is 1
PASS fontFaceSet.status is "loaded"
PASS item.done is false
-PASS item.value.length is 2
-FAIL item.value[0] should be 0 (of type number). Was [object FontFace] (of type object).
-PASS item.value[1] is fontFace1
+PASS item.value is [fontFace1, fontFace1]
PASS item.done is true
-PASS item.value is undefined
PASS item.done is false
PASS item.value is fontFace1
PASS item.done is true
Modified: trunk/LayoutTests/fast/text/font-face-set-_javascript_.html (202302 => 202303)
--- trunk/LayoutTests/fast/text/font-face-set-_javascript_.html 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/LayoutTests/fast/text/font-face-set-_javascript_.html 2016-06-21 23:24:37 UTC (rev 202303)
@@ -23,12 +23,9 @@
var iterator = fontFaceSet.entries();
var item = iterator.next();
shouldBeFalse("item.done");
-shouldBe("item.value.length", "2");
-shouldBe("item.value[0]", "0");
-shouldBe("item.value[1]", "fontFace1");
+shouldBe("item.value", "[fontFace1, fontFace1]");
item = iterator.next();
shouldBeTrue("item.done");
-shouldBe("item.value", "undefined");
iterator = fontFaceSet.keys();
item = iterator.next();
Modified: trunk/Source/WebCore/ChangeLog (202302 => 202303)
--- trunk/Source/WebCore/ChangeLog 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/ChangeLog 2016-06-21 23:24:37 UTC (rev 202303)
@@ -1,5 +1,18 @@
2016-06-21 Jiewen Tan <[email protected]>
+ Unreviewed, rolling out r200619.
+
+ This incompleted feature broke http://m.yahoo.co.jp. Roll it
+ out together with r200678.
+
+ Reverted changeset:
+
+ "NodeList should be iterable"
+ https://bugs.webkit.org/show_bug.cgi?id=131443
+ http://trac.webkit.org/changeset/200619
+
+2016-06-21 Jiewen Tan <[email protected]>
+
Unreviewed, rolling out r200678.
This incompleted feature broke http://m.yahoo.co.jp. Roll it
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (202302 => 202303)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-06-21 23:24:37 UTC (rev 202303)
@@ -267,8 +267,7 @@
template<typename T, size_t inlineCapacity> JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, const Vector<T, inlineCapacity>*);
WEBCORE_EXPORT JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, DOMStringList*);
-JSC::JSValue jsPair(JSC::ExecState&, JSDOMGlobalObject*, JSC::JSValue, JSC::JSValue);
-template<typename FirstType, typename SecondType> JSC::JSValue jsPair(JSC::ExecState&, JSDOMGlobalObject*, const FirstType&, const SecondType&);
+template<typename Value1, typename Value2> JSC::JSValue jsPair(JSC::ExecState&, JSDOMGlobalObject*, const Value1&, const Value2&);
RefPtr<JSC::ArrayBufferView> toArrayBufferView(JSC::JSValue);
RefPtr<JSC::Int8Array> toInt8Array(JSC::JSValue);
@@ -626,19 +625,14 @@
return jsArray(exec, globalObject, *vector);
}
-inline JSC::JSValue jsPair(JSC::ExecState& state, JSDOMGlobalObject* globalObject, JSC::JSValue value1, JSC::JSValue value2)
+template<typename Value1, typename Value2> inline JSC::JSValue jsPair(JSC::ExecState& state, JSDOMGlobalObject* globalObject, const Value1& value1, const Value2& value2)
{
JSC::MarkedArgumentBuffer args;
- args.append(value1);
- args.append(value2);
+ args.append(toJS(&state, globalObject, value1));
+ args.append(toJS(&state, globalObject, value2));
return constructArray(&state, 0, globalObject, args);
}
-template<typename FirstType, typename SecondType> inline JSC::JSValue jsPair(JSC::ExecState& state, JSDOMGlobalObject* globalObject, const FirstType& value1, const SecondType& value2)
-{
- return jsPair(state, globalObject, toJS(&state, globalObject, value1), toJS(&state, globalObject, value2));
-}
-
inline RefPtr<JSC::ArrayBufferView> toArrayBufferView(JSC::JSValue value)
{
auto* wrapper = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(value);
Modified: trunk/Source/WebCore/bindings/js/JSDOMIterator.h (202302 => 202303)
--- trunk/Source/WebCore/bindings/js/JSDOMIterator.h 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/js/JSDOMIterator.h 2016-06-21 23:24:37 UTC (rev 202303)
@@ -60,16 +60,6 @@
void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
};
-template<typename IteratorValue>
-class IteratorInspector {
-private:
- template<typename T> static constexpr auto test(int) -> decltype(std::declval<T>()->key, std::declval<T>()->value, bool()) { return true; }
- template<typename T> static constexpr bool test(...) { return false; }
-public:
- static constexpr bool isMap = test<IteratorValue>(0);
- static constexpr bool isSet = !isMap;
-};
-
enum class IterationKind { Key, Value, KeyValue };
template<typename JSWrapper>
@@ -115,12 +105,7 @@
};
template<typename JSWrapper>
-JSC::EncodedJSValue iteratorCreate(JSC::ExecState&, IterationKind, const char*);
-template<typename JSWrapper>
-JSC::EncodedJSValue iteratorForEach(JSC::ExecState&, const char*);
-
-template<typename JSWrapper>
-JSC::EncodedJSValue iteratorCreate(JSC::ExecState& state, IterationKind kind, const char* propertyName)
+JSC::EncodedJSValue createKeyValueIterator(JSC::ExecState& state, IterationKind kind, const char* propertyName)
{
auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
if (UNLIKELY(!wrapper))
@@ -129,47 +114,8 @@
return JSC::JSValue::encode(JSDOMIterator<JSWrapper>::create(globalObject.vm(), getDOMStructure<JSDOMIterator<JSWrapper>>(globalObject.vm(), globalObject), *wrapper, kind));
}
-template<typename IteratorValue> typename std::enable_if<IteratorInspector<IteratorValue>::isMap, JSC::JSValue>::type
-toJS(JSC::ExecState& state, JSDOMGlobalObject* globalObject, IteratorValue& value, IterationKind kind)
-{
- ASSERT(value);
- if (kind != IterationKind::KeyValue)
- return toJS(&state, globalObject, (kind == IterationKind::Key) ? value->key : value->value);
-
- return jsPair(state, globalObject, value->key, value->value);
-}
-
-template<typename IteratorValue> typename std::enable_if<IteratorInspector<IteratorValue>::isSet, JSC::JSValue>::type
-toJS(JSC::ExecState& state, JSDOMGlobalObject* globalObject, IteratorValue& value, IterationKind kind)
-{
- ASSERT(value);
- JSC::JSValue result = toJS(&state, globalObject, *value);
- if (kind != IterationKind::KeyValue)
- return result;
-
- // FIXME: first pair value should be the index of result.
- return jsPair(state, globalObject, result, result);
-}
-
-template<typename IteratorValue> typename std::enable_if<IteratorInspector<IteratorValue>::isMap, void>::type
-appendForEachArguments(JSC::ExecState& state, JSDOMGlobalObject* globalObject, JSC::MarkedArgumentBuffer& arguments, IteratorValue& value)
-{
- ASSERT(value);
- arguments.append(toJS(&state, globalObject, value->value));
- arguments.append(toJS(&state, globalObject, value->key));
-}
-
-template<typename IteratorValue> typename std::enable_if<IteratorInspector<IteratorValue>::isSet, void>::type
-appendForEachArguments(JSC::ExecState& state, JSDOMGlobalObject* globalObject, JSC::MarkedArgumentBuffer& arguments, IteratorValue& value)
-{
- ASSERT(value);
- JSC::JSValue argument = toJS(&state, globalObject, *value);
- arguments.append(argument);
- arguments.append(argument);
-}
-
template<typename JSWrapper>
-JSC::EncodedJSValue iteratorForEach(JSC::ExecState& state, const char* propertyName)
+JSC::EncodedJSValue keyValueIteratorForEach(JSC::ExecState& state, const char* propertyName)
{
auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
if (UNLIKELY(!wrapper))
@@ -183,7 +129,8 @@
auto iterator = wrapper->wrapped().createIterator();
while (auto value = iterator.next()) {
JSC::MarkedArgumentBuffer arguments;
- appendForEachArguments(state, wrapper->globalObject(), arguments, value);
+ arguments.append(toJS(&state, wrapper->globalObject(), value.value().value));
+ arguments.append(toJS(&state, wrapper->globalObject(), value.value().key));
arguments.append(wrapper);
JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments);
if (state.hadException())
@@ -205,7 +152,16 @@
auto iteratorValue = m_iterator.next();
if (!iteratorValue)
return createIteratorResultObject(&state, JSC::jsUndefined(), true);
- return createIteratorResultObject(&state, toJS(state, globalObject(), iteratorValue, m_kind), false);
+
+ JSC::JSValue value;
+ if (m_kind == IterationKind::Value)
+ value = toJS(&state, globalObject(), iteratorValue.value().value);
+ else if (m_kind == IterationKind::Key)
+ value = toJS(&state, globalObject(), iteratorValue.value().key);
+ else
+ value = jsPair(state, globalObject(), iteratorValue.value().key, iteratorValue.value().value);
+
+ return createIteratorResultObject(&state, value, false);
}
template<typename JSWrapper>
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (202302 => 202303)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-06-21 23:24:37 UTC (rev 202303)
@@ -4181,6 +4181,10 @@
{
my $interface = shift;
+ if (not $interface->iterable->isKeyValue) {
+ die "No support yet for set iterators";
+ }
+
my $interfaceName = $interface->name;
my $className = "JS$interfaceName";
my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
@@ -4207,11 +4211,10 @@
my $iterationKind = "KeyValue";
$iterationKind = "Key" if $propertyName eq "keys";
$iterationKind = "Value" if $propertyName eq "values";
- $iterationKind = "Value" if $propertyName eq "[Symbol.Iterator]" and not $interface->iterable->isKeyValue;
push(@implContent, <<END);
JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState* state)
{
- return iteratorCreate<${className}>(*state, IterationKind::${iterationKind}, "${propertyName}");
+ return createKeyValueIterator<${className}>(*state, IterationKind::${iterationKind}, "${propertyName}");
}
END
@@ -4219,7 +4222,7 @@
push(@implContent, <<END);
JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState* state)
{
- return iteratorForEach<${className}>(*state, "${propertyName}");
+ return keyValueIteratorForEach<${className}>(*state, "${propertyName}");
}
END
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (202302 => 202303)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-06-21 23:24:37 UTC (rev 202303)
@@ -24,7 +24,6 @@
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
-#include "JSDOMIterator.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
@@ -34,14 +33,6 @@
namespace WebCore {
-// Functions
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionSymbolIterator(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionEntries(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionKeys(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionValues(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionForEach(JSC::ExecState*);
-
// Attributes
JSC::EncodedJSValue jsTestNodeName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -103,10 +94,6 @@
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeConstructor) } },
{ "name", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeName) } },
- { "entries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionEntries), (intptr_t) (0) } },
- { "keys", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionKeys), (intptr_t) (0) } },
- { "values", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionValues), (intptr_t) (0) } },
- { "forEach", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionForEach), (intptr_t) (1) } },
};
const ClassInfo JSTestNodePrototype::s_info = { "TestNodePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNodePrototype) };
@@ -115,7 +102,6 @@
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestNodePrototypeTableValues, *this);
- putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
}
const ClassInfo JSTestNode::s_info = { "TestNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };
@@ -192,40 +178,6 @@
return getDOMConstructor<JSTestNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
-using TestNodeIterator = JSDOMIterator<JSTestNode>;
-using TestNodeIteratorPrototype = JSDOMIteratorPrototype<JSTestNode>;
-
-template<>
-const JSC::ClassInfo TestNodeIterator::s_info = { "TestNode Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestNodeIterator) };
-
-template<>
-const JSC::ClassInfo TestNodeIteratorPrototype::s_info = { "TestNode Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestNodeIteratorPrototype) };
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionSymbolIterator(JSC::ExecState* state)
-{
- return iteratorCreate<JSTestNode>(*state, IterationKind::Value, "[Symbol.Iterator]");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionEntries(JSC::ExecState* state)
-{
- return iteratorCreate<JSTestNode>(*state, IterationKind::KeyValue, "entries");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionKeys(JSC::ExecState* state)
-{
- return iteratorCreate<JSTestNode>(*state, IterationKind::Key, "keys");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionValues(JSC::ExecState* state)
-{
- return iteratorCreate<JSTestNode>(*state, IterationKind::Value, "values");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionForEach(JSC::ExecState* state)
-{
- return iteratorForEach<JSTestNode>(*state, "forEach");
-}
-
void JSTestNode::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSTestNode*>(cell);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (202302 => 202303)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-06-21 23:24:37 UTC (rev 202303)
@@ -6217,27 +6217,27 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSymbolIterator(JSC::ExecState* state)
{
- return iteratorCreate<JSTestObj>(*state, IterationKind::KeyValue, "[Symbol.Iterator]");
+ return createKeyValueIterator<JSTestObj>(*state, IterationKind::KeyValue, "[Symbol.Iterator]");
}
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEntries(JSC::ExecState* state)
{
- return iteratorCreate<JSTestObj>(*state, IterationKind::KeyValue, "entries");
+ return createKeyValueIterator<JSTestObj>(*state, IterationKind::KeyValue, "entries");
}
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionKeys(JSC::ExecState* state)
{
- return iteratorCreate<JSTestObj>(*state, IterationKind::Key, "keys");
+ return createKeyValueIterator<JSTestObj>(*state, IterationKind::Key, "keys");
}
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionValues(JSC::ExecState* state)
{
- return iteratorCreate<JSTestObj>(*state, IterationKind::Value, "values");
+ return createKeyValueIterator<JSTestObj>(*state, IterationKind::Value, "values");
}
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionForEach(JSC::ExecState* state)
{
- return iteratorForEach<JSTestObj>(*state, "forEach");
+ return keyValueIteratorForEach<JSTestObj>(*state, "forEach");
}
void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor)
Modified: trunk/Source/WebCore/bindings/scripts/test/TestNode.idl (202302 => 202303)
--- trunk/Source/WebCore/bindings/scripts/test/TestNode.idl 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/bindings/scripts/test/TestNode.idl 2016-06-21 23:24:37 UTC (rev 202303)
@@ -23,7 +23,5 @@
ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
] interface TestNode : Node {
attribute DOMString name;
-
- iterable<TestNode>;
};
Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (202302 => 202303)
--- trunk/Source/WebCore/css/FontFaceSet.cpp 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp 2016-06-21 23:24:37 UTC (rev 202303)
@@ -76,11 +76,12 @@
{
}
-RefPtr<FontFace> FontFaceSet::Iterator::next()
+Optional<WTF::KeyValuePair<RefPtr<FontFace>, RefPtr<FontFace>>> FontFaceSet::Iterator::next()
{
if (m_index == m_target->size())
- return nullptr;
- return m_target->backing()[m_index++].wrapper();
+ return Nullopt;
+ RefPtr<FontFace> item = m_target->backing()[m_index++].wrapper();
+ return WTF::KeyValuePair<RefPtr<FontFace>, RefPtr<FontFace>>(item, item);
}
FontFaceSet::PendingPromise::PendingPromise(LoadPromise&& promise)
Modified: trunk/Source/WebCore/css/FontFaceSet.h (202302 => 202303)
--- trunk/Source/WebCore/css/FontFaceSet.h 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/css/FontFaceSet.h 2016-06-21 23:24:37 UTC (rev 202303)
@@ -62,7 +62,7 @@
class Iterator {
public:
explicit Iterator(FontFaceSet&);
- RefPtr<FontFace> next();
+ Optional<WTF::KeyValuePair<RefPtr<FontFace>, RefPtr<FontFace>>> next();
private:
Ref<FontFaceSet> m_target;
Modified: trunk/Source/WebCore/css/FontFaceSet.idl (202302 => 202303)
--- trunk/Source/WebCore/css/FontFaceSet.idl 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/css/FontFaceSet.idl 2016-06-21 23:24:37 UTC (rev 202303)
@@ -35,7 +35,8 @@
boolean has(FontFace font);
// FIXME: We should add support for the setlike declaration.
- iterable<FontFace>;
+ // As a first step this map iterable declaration should be changed to a set iterable.
+ iterable<FontFace, FontFace>;
readonly attribute long size;
Modified: trunk/Source/WebCore/dom/NodeList.h (202302 => 202303)
--- trunk/Source/WebCore/dom/NodeList.h 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/dom/NodeList.h 2016-06-21 23:24:37 UTC (rev 202303)
@@ -40,17 +40,6 @@
virtual unsigned length() const = 0;
virtual Node* item(unsigned index) const = 0;
- class Iterator {
- public:
- explicit Iterator(NodeList& list) : m_list(list) { }
- Node* next() { return m_list->item(m_index++); }
-
- private:
- size_t m_index { 0 };
- Ref<NodeList> m_list;
- };
- Iterator createIterator() { return Iterator(*this); }
-
// Other methods (not part of DOM)
virtual bool isLiveNodeList() const { return false; }
virtual bool isChildNodeList() const { return false; }
Modified: trunk/Source/WebCore/dom/NodeList.idl (202302 => 202303)
--- trunk/Source/WebCore/dom/NodeList.idl 2016-06-21 23:21:14 UTC (rev 202302)
+++ trunk/Source/WebCore/dom/NodeList.idl 2016-06-21 23:24:37 UTC (rev 202303)
@@ -27,6 +27,5 @@
] interface NodeList {
getter Node item(unsigned long index);
readonly attribute unsigned long length;
- iterable<Node>;
};