Bug 1512050 - Add not-yet-fully-passing web-platform tests about readable streams to jit-test anyway. r=arai
authorJason Orendorff <jorendorff@mozilla.com>
Sun, 09 Dec 2018 18:03:50 +0000
changeset 449678 c2ecb25b00d4ad095f23e66fb91507c7978fda8b
parent 449677 a6eb6e3732aea5d375757a28ea5cfe3de430a6f9
child 449679 3d9e1dd87d4539957dbcfa5ff93ef5c2b3036e8f
push idunknown
push userunknown
push dateunknown
reviewersarai
bugs1512050
milestone65.0a1
Bug 1512050 - Add not-yet-fully-passing web-platform tests about readable streams to jit-test anyway. r=arai Differential Revision: https://phabricator.services.mozilla.com/D13750
js/src/jit-test/tests/web-platform/streams/readable-streams/general.js
js/src/jit-test/tests/web-platform/streams/readable-streams/reentrant-strategies.js
js/src/jit-test/tests/web-platform/streams/readable-streams/templated.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/web-platform/streams/readable-streams/general.js
@@ -0,0 +1,28 @@
+// The web-platform test we're going to load (on the last line of this file)
+// contains many tests; among them, it checks for the existence of pipeTo and
+// pipeThrough, which we don't implement yet. Hack it:
+if (ReadableStream.prototype.pipeTo || ReadableStream.prototype.pipeThrough) {
+  throw new Error("Congratulations on implementing pipeTo/pipeThrough! Please update this test.\n");
+}
+// They don't have to work to pass the test, just exist:
+Object.defineProperties(ReadableStream.prototype, {
+  "pipeTo": {
+    configurable: true,
+    writable: true,
+    enumerable: false,
+    value: function pipeTo(dest, {preventClose, preventAbort, preventCancel, signal} = {}) {
+      throw new InternalError("pipeTo: not implemented");
+    },
+  },
+  "pipeThrough": {
+    configurable: true,
+    writable: true,
+    enumerable: false,
+    value: function pipeThrough({writable, readable}, {preventClose, preventAbort, preventCancel, signal}) {
+      throw new InternalError("pipeThrough: not implemented");
+    },
+  },
+});
+
+load(libdir + "web-platform-testharness.js");
+load_web_platform_test("streams/readable-streams/general.js");
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/web-platform/streams/readable-streams/reentrant-strategies.js
@@ -0,0 +1,4 @@
+// |jit-test| error: ReferenceError: WritableStream is not defined
+
+load(libdir + "web-platform-testharness.js");
+load_web_platform_test("streams/readable-streams/reentrant-strategies.js");
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/web-platform/streams/readable-streams/templated.js
@@ -0,0 +1,28 @@
+// The web-platform test we're going to load (on the last line of this file)
+// contains many tests; among them, it checks for the existence of pipeTo and
+// pipeThrough, which we don't implement yet. Hack it:
+if (ReadableStream.prototype.pipeTo || ReadableStream.prototype.pipeThrough) {
+  throw new Error("Congratulations on implementing pipeTo/pipeThrough! Please update this test.\n");
+}
+// They don't have to work to pass the test, just exist:
+Object.defineProperties(ReadableStream.prototype, {
+  "pipeTo": {
+    configurable: true,
+    writable: true,
+    enumerable: false,
+    value: function pipeTo(dest, {preventClose, preventAbort, preventCancel, signal} = {}) {
+      throw new InternalError("pipeTo: not implemented");
+    },
+  },
+  "pipeThrough": {
+    configurable: true,
+    writable: true,
+    enumerable: false,
+    value: function pipeThrough({writable, readable}, {preventClose, preventAbort, preventCancel, signal}) {
+      throw new InternalError("pipeThrough: not implemented");
+    },
+  },
+});
+
+load(libdir + "web-platform-testharness.js");
+load_web_platform_test("streams/readable-streams/templated.js");