Bug 1450905 [wpt PR 10277] - Update ReadableStream to latest standard version, a=testonly
authorAdam Rice <ricea@chromium.org>
Mon, 09 Apr 2018 22:28:47 +0000
changeset 413788 04639022a761c8731ff1eef60b124935df809765
parent 413787 f1e731ebb6bb0614bb31f287112ef2c320925a25
child 413789 3c8a0973bc175a59fa0fb0b68440c8ac6d0408db
push id33850
push userapavel@mozilla.com
push dateMon, 16 Apr 2018 09:53:48 +0000
treeherdermozilla-central@6276ec7ebbf3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1450905, 10277, 710728, 992077, 548784
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1450905 [wpt PR 10277] - Update ReadableStream to latest standard version, a=testonly Automatic update from web-platform-testsUpdate ReadableStream to latest standard version Update Blink's implementation of ReadableStream to https://streams.spec.whatwg.org/commit-snapshots/37ace3d5f16cbea7aec4a0c80532c95059994d51/ This also updates TransformStream to use CreateReadableStream() instead of calling the ReadableStream constructor. Several common operations have become unused and have been removed. The EXTERNALLY_CONTROLLED flag has been renamed to the slightly more specific name "BLINK_LOCK_NOTIFICATIONS". All external/wpt/streams/readable-streams tests now pass, and failing expectations have been removed. Most changes were already covered by the web-platform-tests. A new readable-streams/patched-global.js test verifies that ReadableStreamTee() does not use the global ReadableStream constructor or otherwise touch the global object. BUG=710728 Change-Id: I2b799045f47376adef305f5f88ad106161425b46 Reviewed-on: https://chromium-review.googlesource.com/992077 Commit-Queue: Adam Rice <ricea@chromium.org> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#548784} wpt-commits: 8314b7b5ae86ebf5bc435558ae5b0af32b1d7756 wpt-pr: 10277 wpt-commits: 8314b7b5ae86ebf5bc435558ae5b0af32b1d7756 wpt-pr: 10277
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/streams/readable-streams/patched-global.dedicatedworker.html
testing/web-platform/tests/streams/readable-streams/patched-global.html
testing/web-platform/tests/streams/readable-streams/patched-global.js
testing/web-platform/tests/streams/readable-streams/patched-global.serviceworker.https.html
testing/web-platform/tests/streams/readable-streams/patched-global.sharedworker.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -294193,16 +294193,21 @@
      {}
     ]
    ],
    "streams/readable-streams/general.js": [
     [
      {}
     ]
    ],
+   "streams/readable-streams/patched-global.js": [
+    [
+     {}
+    ]
+   ],
    "streams/readable-streams/reentrant-strategies.js": [
     [
      {}
     ]
    ],
    "streams/readable-streams/tee.js": [
     [
      {}
@@ -364095,16 +364100,40 @@
     ]
    ],
    "streams/readable-streams/general.sharedworker.html": [
     [
      "/streams/readable-streams/general.sharedworker.html",
      {}
     ]
    ],
+   "streams/readable-streams/patched-global.dedicatedworker.html": [
+    [
+     "/streams/readable-streams/patched-global.dedicatedworker.html",
+     {}
+    ]
+   ],
+   "streams/readable-streams/patched-global.html": [
+    [
+     "/streams/readable-streams/patched-global.html",
+     {}
+    ]
+   ],
+   "streams/readable-streams/patched-global.serviceworker.https.html": [
+    [
+     "/streams/readable-streams/patched-global.serviceworker.https.html",
+     {}
+    ]
+   ],
+   "streams/readable-streams/patched-global.sharedworker.html": [
+    [
+     "/streams/readable-streams/patched-global.sharedworker.html",
+     {}
+    ]
+   ],
    "streams/readable-streams/reentrant-strategies.dedicatedworker.html": [
     [
      "/streams/readable-streams/reentrant-strategies.dedicatedworker.html",
      {}
     ]
    ],
    "streams/readable-streams/reentrant-strategies.html": [
     [
@@ -598118,16 +598147,36 @@
   "streams/readable-streams/general.serviceworker.https.html": [
    "1792d6c45a5687777291a4dab031a954aa053752",
    "testharness"
   ],
   "streams/readable-streams/general.sharedworker.html": [
    "44f9ceaa3bfc9d8b92885997d322486bd0f237a6",
    "testharness"
   ],
+  "streams/readable-streams/patched-global.dedicatedworker.html": [
+   "34bc5da1733179d1a4cd4bbbd4397146eafbb7e8",
+   "testharness"
+  ],
+  "streams/readable-streams/patched-global.html": [
+   "a3c2a68709b9bf1eb3f34dd2d0f385689680a566",
+   "testharness"
+  ],
+  "streams/readable-streams/patched-global.js": [
+   "acd674d94f102891043aa92113026aca6c1ae5d7",
+   "support"
+  ],
+  "streams/readable-streams/patched-global.serviceworker.https.html": [
+   "79f5e148601acf4ad24952f8735908c3a1edc510",
+   "testharness"
+  ],
+  "streams/readable-streams/patched-global.sharedworker.html": [
+   "477cc1ed4cc94ff6ee29dcd6f96c16768a2c7567",
+   "testharness"
+  ],
   "streams/readable-streams/reentrant-strategies.dedicatedworker.html": [
    "6f9350ce1caf4fa9e6239693ec91b2249c2adab5",
    "testharness"
   ],
   "streams/readable-streams/reentrant-strategies.html": [
    "3ccd828e098956d0697c1f0e8809aa67d7945f2b",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/streams/readable-streams/patched-global.dedicatedworker.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>patched-global.js dedicated worker wrapper file</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+'use strict';
+fetch_tests_from_worker(new Worker('patched-global.js'));
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/streams/readable-streams/patched-global.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>patched-global.js browser context wrapper file</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+
+
+<script src="patched-global.js"></script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/streams/readable-streams/patched-global.js
@@ -0,0 +1,67 @@
+'use strict';
+
+// Tests which patch the global environment are kept separate to avoid
+// interfering with other tests.
+
+if (self.importScripts) {
+  self.importScripts('/resources/testharness.js');
+}
+
+const ReadableStream_prototype_locked_get =
+      Object.getOwnPropertyDescriptor(ReadableStream.prototype, 'locked').get;
+
+// Verify that |rs| passes the brand check as a readable stream.
+function isReadableStream(rs) {
+  try {
+    ReadableStream_prototype_locked_get.call(rs);
+    return true;
+  } catch (e) {
+    return false;
+  }
+}
+
+test(t => {
+  const rs = new ReadableStream();
+
+  const trappedProperties = ['highWaterMark', 'size', 'start', 'type', 'mode'];
+  for (const property of trappedProperties) {
+    // eslint-disable-next-line no-extend-native, accessor-pairs
+    Object.defineProperty(Object.prototype, property, {
+      get() { throw new Error(`${property} getter called`); },
+      configurable: true
+    });
+  }
+  t.add_cleanup(() => {
+    for (const property of trappedProperties) {
+      delete Object.prototype[property];
+    }
+  });
+
+  const [branch1, branch2] = rs.tee();
+  assert_true(isReadableStream(branch1), 'branch1 should be a ReadableStream');
+  assert_true(isReadableStream(branch2), 'branch2 should be a ReadableStream');
+}, 'ReadableStream tee() should not touch Object.prototype properties');
+
+test(t => {
+  const rs = new ReadableStream();
+
+  const oldReadableStream = self.ReadableStream;
+
+  /* eslint-disable no-native-reassign */
+  self.ReadableStream = function() {
+    throw new Error('ReadableStream called on global object');
+  };
+
+  t.add_cleanup(() => {
+    self.ReadableStream = oldReadableStream;
+  });
+
+  const [branch1, branch2] = rs.tee();
+
+  assert_true(isReadableStream(branch1), 'branch1 should be a ReadableStream');
+  assert_true(isReadableStream(branch2), 'branch2 should be a ReadableStream');
+
+  /* eslint-enable no-native-reassign */
+}, 'ReadableStream tee() should not call the global ReadableStream');
+
+done();
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/streams/readable-streams/patched-global.serviceworker.https.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>patched-global.js service worker wrapper file</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+
+<script>
+'use strict';
+service_worker_test('patched-global.js', 'Service worker test setup');
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/streams/readable-streams/patched-global.sharedworker.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>patched-global.js shared worker wrapper file</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+'use strict';
+fetch_tests_from_worker(new SharedWorker('patched-global.js'));
+</script>