ddDictType("contentProcessTarget.workers", {
  error: "nullable:string",
  workers: "nullable:array:workerTarget",
});

const contentProcessTargetSpec = generateActorSpec({
  typeName: "contentProcessTarget",

  methods: {
    listWorkers: {
      request: {},
      response: RetVal("contentProcessTarget.workers"),
    },

    pauseMatchingServiceWorkers: {
      request: {
        origin: Option(0, "string"),
      },
      response: {},
    },
  },

  events: {
    workerListChanged: {
      type: "workerListChanged",
    },

    // The thread actor is no longer emitting newSource event in the name of the target
    // actor (bug 1269919), but as we may still connect to older servers which still do,
    // we have to keep it being mentioned here. Otherwise the event is considered as a
    // response to a request and confuses the packet ordering.
    // We can remove that once FF66 is no longer supported.
    newSource: {
      type: "newSource",
    },
    tabDetached: {
      type: "tabDetached",
      from: Option(0, "string"),
    },
  },
});

exports.contentProcessTargetSpec = contentProcessTargetSpec;
PK