https://bugs.webkit.org/show_bug.cgi?id=152436
Reviewed by Darin Adler.
GCController is not available in Worker environments, explaining probably why garbage-collection-2.html is not crashing at all.
Inlining half of the tests in garbage-collection-2.html (runned in window) to compare with garbage-collection-1.html.
* web-platform-tests/streams-api/readable-streams/garbage-collection-2-expected.txt:
* web-platform-tests/streams-api/readable-streams/garbage-collection-2.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195924
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2016-01-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ imported/w3c/web-platform-tests/streams-api/readable-streams/garbage-collection.html asserts frequently
+ https://bugs.webkit.org/show_bug.cgi?id=152436
+
+ Reviewed by Darin Adler.
+
+ GCController is not available in Worker environments, explaining probably why garbage-collection-2.html is not crashing at all.
+ Inlining half of the tests in garbage-collection-2.html (runned in window) to compare with garbage-collection-1.html.
+
+ * web-platform-tests/streams-api/readable-streams/garbage-collection-2-expected.txt:
+ * web-platform-tests/streams-api/readable-streams/garbage-collection-2.html:
+
2016-01-30 Chris Dumez <cdumez@apple.com>
[JS Bindings] prototype.constructor should be writable
PASS ReadableStreamController methods should continue working properly when scripts lose their reference to the readable stream
PASS ReadableStream closed promise should fulfill even if the stream and reader JS references are lost
-PASS ReadableStream closed promise should reject even if stream and reader JS references are lost
-PASS Garbage-collecting a ReadableStreamReader should not unlock its stream
<!-- File to be removed once https://bugs.webkit.org/show_bug.cgi?id=152436 is resolved -->
<script>
'use strict';
-fetch_tests_from_worker(new Worker('garbage-collection.js'));
+
+promise_test(() => {
+
+ let controller;
+ new ReadableStream({
+ start(c) {
+ controller = c;
+ }
+ });
+
+ garbageCollect();
+
+ return delay(50).then(() => {
+ controller.close();
+ assert_throws(new TypeError(), () => controller.close(), 'close should throw a TypeError the second time');
+ assert_throws(new TypeError(), () => controller.error(), 'error should throw a TypeError on a closed stream');
+ });
+
+}, 'ReadableStreamController methods should continue working properly when scripts lose their reference to the ' +
+ 'readable stream');
+
+promise_test(() => {
+
+ let controller;
+
+ const closedPromise = new ReadableStream({
+ start(c) {
+ controller = c;
+ }
+ }).getReader().closed;
+
+ garbageCollect();
+
+ return delay(50).then(() => controller.close()).then(() => closedPromise);
+
+}, 'ReadableStream closed promise should fulfill even if the stream and reader JS references are lost');
</script>