tor-browser

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

manifest.js (1091B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const { Actor } = require("resource://devtools/shared/protocol.js");
      8 const {
      9  manifestSpec,
     10 } = require("resource://devtools/shared/specs/manifest.js");
     11 
     12 const lazy = {};
     13 
     14 ChromeUtils.defineESModuleGetters(
     15  lazy,
     16  {
     17    ManifestObtainer: "resource://gre/modules/ManifestObtainer.sys.mjs",
     18  },
     19  { global: "contextual" }
     20 );
     21 
     22 /**
     23 * An actor for a Web Manifest
     24 */
     25 class ManifestActor extends Actor {
     26  constructor(conn, targetActor) {
     27    super(conn, manifestSpec);
     28    this.targetActor = targetActor;
     29  }
     30 
     31  async fetchCanonicalManifest() {
     32    try {
     33      const manifest = await lazy.ManifestObtainer.contentObtainManifest(
     34        this.targetActor.window,
     35        { checkConformance: true }
     36      );
     37      return { manifest };
     38    } catch (error) {
     39      return { manifest: null, errorMessage: error.message };
     40    }
     41  }
     42 }
     43 
     44 exports.ManifestActor = ManifestActor;