Bug 1566341 [wpt PR 17804] - Implement QueuingStrategies in C++, a=testonly

Automatic update from web-platform-tests
Implement QueuingStrategies in C++

Implement CountQueuingStrategy and ByteLengthQueuingStrategy in C++.

Implementing in WebIDL leads to some changes in semantics:

1. highWaterMark is now a getter on the prototype rather than an
property on each object. This is because adding properties directly on
objects is not usual practice in WebIDL, and is problematic to implement
in Blink.

2. size() is now a function returned by a getter. This is because a
methods in WebIDL must be called with |this| set to a valid object of
the appropriate type, but size() is called with |this| set to undefined.
See https://github.com/whatwg/streams/issues/1005 for more discussion.

These aren't expected to change behaviour of code in the wild, but the
count-queuing-strategy.any.js and byte-length-queuing-strategy.js
tests detect it.

Also add tests that subclassing of CountQueuingStrategy and
ByteLengthQueuingStrategyworks works properly. A previous iteration
of this change broke it.

Bug: 981333
Change-Id: Ifc18a469a58f73d54563ca549a1c8db0e001303b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1692108
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679897}

--

wpt-commits: 4dbc86fa9b79da17a037140fc2eaba05c80f90ee
wpt-pr: 17804
This commit is contained in:
Adam Rice 2019-07-30 17:52:29 +00:00 коммит произвёл moz-wptsync-bot
Родитель 3e056c55e1
Коммит b22ef3a053
2 изменённых файлов: 46 добавлений и 0 удалений

Просмотреть файл

@ -107,3 +107,26 @@ test(() => {
'ByteLengthQueuingStrategy.name must be "ByteLengthQueuingStrategy"'); 'ByteLengthQueuingStrategy.name must be "ByteLengthQueuingStrategy"');
}, 'ByteLengthQueuingStrategy.name is correct'); }, 'ByteLengthQueuingStrategy.name is correct');
class SubClass extends ByteLengthQueuingStrategy {
size() {
return 2;
}
subClassMethod() {
return true;
}
}
test(() => {
const sc = new SubClass({highWaterMark: 77});
assert_equals(sc.constructor.name, 'SubClass',
'constructor.name should be correct');
assert_equals(sc.highWaterMark, 77,
'highWaterMark should come from the parent class');
assert_equals(sc.size(), 2,
'size() on the subclass should override the parent');
assert_true(sc.subClassMethod(), 'subClassMethod() should work');
}, 'subclassing ByteLengthQueuingStrategy should work correctly');

Просмотреть файл

@ -106,3 +106,26 @@ test(() => {
'CountQueuingStrategy.name must be "CountQueuingStrategy"'); 'CountQueuingStrategy.name must be "CountQueuingStrategy"');
}, 'CountQueuingStrategy.name is correct'); }, 'CountQueuingStrategy.name is correct');
class SubClass extends CountQueuingStrategy {
size() {
return 2;
}
subClassMethod() {
return true;
}
}
test(() => {
const sc = new SubClass({highWaterMark: 77});
assert_equals(sc.constructor.name, 'SubClass',
'constructor.name should be correct');
assert_equals(sc.highWaterMark, 77,
'highWaterMark should come from the parent class');
assert_equals(sc.size(), 2,
'size() on the subclass should override the parent');
assert_true(sc.subClassMethod(), 'subClassMethod() should work');
}, 'subclassing CountQueuingStrategy should work correctly');