tor-browser

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

content-process.js (1694B)


      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 "use strict";
      5 
      6 const {
      7  contentProcessTargetSpec,
      8 } = require("resource://devtools/shared/specs/targets/content-process.js");
      9 const {
     10  FrontClassWithSpec,
     11  registerFront,
     12 } = require("resource://devtools/shared/protocol.js");
     13 const {
     14  TargetMixin,
     15 } = require("resource://devtools/client/fronts/targets/target-mixin.js");
     16 
     17 class ContentProcessTargetFront extends TargetMixin(
     18  FrontClassWithSpec(contentProcessTargetSpec)
     19 ) {
     20  constructor(client, targetFront, parentFront) {
     21    super(client, targetFront, parentFront);
     22 
     23    this.traits = {};
     24  }
     25 
     26  form(json) {
     27    this.actorID = json.actor;
     28    this.processID = json.processID;
     29 
     30    // Save the full form for Target class usage.
     31    // Do not use `form` name to avoid colliding with protocol.js's `form` method
     32    this.targetForm = json;
     33 
     34    this.remoteType = json.remoteType;
     35    this.isXpcShellTarget = json.isXpcShellTarget;
     36  }
     37 
     38  get name() {
     39    // @backward-compat { version 87 } We now have `remoteType` attribute.
     40    if (this.remoteType) {
     41      return `(pid ${this.processID}) ${this.remoteType.replace(
     42        "webIsolated=",
     43        ""
     44      )}`;
     45    }
     46    return `(pid ${this.processID}) Content Process`;
     47  }
     48 
     49  reconfigure() {
     50    // Toolbox and options panel are calling this method but Worker Target can't be
     51    // reconfigured. So we ignore this call here.
     52    return Promise.resolve();
     53  }
     54 }
     55 
     56 exports.ContentProcessTargetFront = ContentProcessTargetFront;
     57 registerFront(exports.ContentProcessTargetFront);