Skip to content
Permalink
Browse files
Iterable interfaces should have their related prototype @@iterator pr…
…operty writable

https://bugs.webkit.org/show_bug.cgi?id=159211
Source/WebCore:

<rdar://problem/26950766>

Patch by Youenn Fablet <youenn@apple.com> on 2016-06-28
Reviewed by Chris Dumez.

Updating @@iterator property according  http://heycam.github.io/webidl/#es-iterator.

Covered by updated test.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Removing ReadOnly flag from @@iterator property of iterable interfaces.
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNodePrototype::finishCreation): Rebasing expectation.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation): Ditto.

LayoutTests:

Patch by Youenn Fablet <youenn@apple.com> on 2016-06-28
Reviewed by Chris Dumez.

* fast/dom/nodeListIterator-expected.txt:
* fast/dom/nodeListIterator.html: Overriding NodeList @@iterator by Array one and checking everything is fine.

Canonical link: https://commits.webkit.org/177330@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf authored and webkit-commit-queue committed Jun 28, 2016
1 parent 9b06c34 commit 36ca43f0fed13b29738cc501f18667dc1837da2d
@@ -1,3 +1,13 @@
2016-06-28 Youenn Fablet <youenn@apple.com>

Iterable interfaces should have their related prototype @@iterator property writable
https://bugs.webkit.org/show_bug.cgi?id=159211

Reviewed by Chris Dumez.

* fast/dom/nodeListIterator-expected.txt:
* fast/dom/nodeListIterator.html: Overriding NodeList @@iterator by Array one and checking everything is fine.

2016-06-28 Jer Noble <jer.noble@apple.com>

Cross-domain video loads do not prompt for authorization.
@@ -38,6 +38,15 @@ PASS end.done is true
PASS end.value is undefined
PASS end.done is true
PASS end.value is undefined
PASS descriptor.configurable is true
PASS descriptor.writable is true
PASS descriptor.enumerable is false
PASS NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; did not throw exception.
PASS a instanceof Node is true
PASS a instanceof Node is true
PASS a instanceof Node is true
PASS a instanceof Node is true
PASS counter is 4
PASS successfullyParsed is true

TEST COMPLETE
@@ -87,6 +87,18 @@
testingGround.appendChild(document.createElement('p'));
checkEndIterator(iterator.next());

var descriptor = Object.getOwnPropertyDescriptor(NodeList.prototype, Symbol.iterator);
shouldBeTrue('descriptor.configurable');
shouldBeTrue('descriptor.writable');
shouldBeFalse('descriptor.enumerable');

shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');
var counter = 0;
for (var a of nodeList) {
shouldBeTrue('a instanceof Node');
counter++;
}
shouldBe('counter', '4');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
@@ -1,3 +1,22 @@
2016-06-28 Youenn Fablet <youenn@apple.com>

Iterable interfaces should have their related prototype @@iterator property writable
https://bugs.webkit.org/show_bug.cgi?id=159211
<rdar://problem/26950766>

Reviewed by Chris Dumez.

Updating @@iterator property according http://heycam.github.io/webidl/#es-iterator.

Covered by updated test.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Removing ReadOnly flag from @@iterator property of iterable interfaces.
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNodePrototype::finishCreation): Rebasing expectation.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation): Ditto.

2016-06-28 Anders Carlsson <andersca@apple.com>

"Total amount is too big" error message is displaying on clicking Pay button
@@ -2310,7 +2310,7 @@ sub GenerateImplementation

if ($interface->iterable) {
my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]);
push(@implContent, " putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), ReadOnly | DontEnum);\n");
push(@implContent, " putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), DontEnum);\n");
}

push(@implContent, "}\n\n");
@@ -115,7 +115,7 @@ void JSTestNodePrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestNodePrototypeTableValues, *this);
putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
}

const ClassInfo JSTestNode::s_info = { "TestNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };
@@ -1327,7 +1327,7 @@ void JSTestObjPrototype::finishCreation(VM& vm)
JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);
putDirect(vm, clientData.builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
putDirect(vm, clientData.builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
}

const ClassInfo JSTestObj::s_info = { "TestObject", &Base::s_info, &JSTestObjTable, CREATE_METHOD_TABLE(JSTestObj) };

0 comments on commit 36ca43f

Please sign in to comment.