summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/streams/transform-streams/invalid-realm.tentative.window.js
blob: 57cdfd94862dfe7832164e13eec7bcc4f302c3de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// TransformStream should still work even if the realm is detached.

// Adds an iframe to the document and returns it.
function addIframe() {
  const iframe = document.createElement('iframe');
  document.body.appendChild(iframe);
  return iframe;
}

promise_test(async t => {
  const iframe = addIframe();
  const stream = new iframe.contentWindow.TransformStream();
  const readPromise = stream.readable.getReader().read();
  const writer = stream.writable.getWriter();
  iframe.remove();
  return Promise.all([writer.write('A'), readPromise]);
}, 'TransformStream: write in detached realm should succeed');