private internalSubmit()

in glean/src/core/pings/ping_type.ts [82:114]


  private internalSubmit(reason?: string, testResolver?: PromiseCallback) {
    if (!Context.initialized) {
      log(LOG_TAG, "Glean must be initialized before submitting pings.", LoggingLevel.Info);
      return;
    }

    if (!Context.uploadEnabled && !isDeletionRequest(this.name)) {
      log(
        LOG_TAG,
        "Glean disabled: not submitting pings. Glean may still submit the deletion-request ping.",
        LoggingLevel.Info
      );
      return;
    }

    let correctedReason = reason;
    if (reason && !this.reasonCodes.includes(reason)) {
      log(LOG_TAG, `Invalid reason code ${reason} from ${this.name}. Ignoring.`, LoggingLevel.Warn);
      correctedReason = undefined;
    }

    const identifier = generateUUIDv4();
    collectAndStorePing(identifier, this, correctedReason);

    if (testResolver) {
      testResolver();

      // Finally clean up!
      this.resolveTestPromiseFunction = undefined;
      this.rejectTestPromiseFunction = undefined;
      this.testCallback = undefined;
    }
  }