tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MediaDrmProvisioning.sys.mjs (865B)


      1 /* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 export function MediaDrmProvisioning() {}
      7 
      8 MediaDrmProvisioning.prototype = {
      9  QueryInterface: ChromeUtils.generateQI([
     10    "nsIMediaDrmProvisioning",
     11    "nsISupport",
     12  ]),
     13 
     14  provision(serverUrl, request) {
     15    const url = serverUrl + "&signedRequest=" + request;
     16    return new Promise((resolve, reject) => {
     17      fetch(url, { method: "POST" })
     18        .then(response => {
     19          response
     20            .bytes()
     21            .then(bytes => {
     22              resolve(bytes);
     23            })
     24            .catch(reject);
     25        })
     26        .catch(reject);
     27    });
     28  },
     29 };