summaryrefslogtreecommitdiffstats
path: root/remote/cdp/test/browser/io/head.js
blob: 4c6a67178ef250ef46b96ee77b5de2e1ca72691f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/remote/cdp/test/browser/head.js",
  this
);

const { streamRegistry } = ChromeUtils.importESModule(
  "chrome://remote/content/cdp/domains/parent/IO.sys.mjs"
);

async function registerFileStream(contents, options) {
  const stream = await createFileStream(contents, options);
  const handle = streamRegistry.add(stream);

  return { handle, stream };
}