How to use the devtools/shared/DevToolsUtils.reportException function in devtools

To help you get started, we’ve selected a few devtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joewalker / devtools.html / server / actors / webconsole.js View on Github external
}

    // Add easter egg for console.mihai().
    if (trimmedString == "console.mihai()" || trimmedString == "console.mihai();") {
      aString = "\"http://incompleteness.me/blog/2015/02/09/console-dot-mihai/\"";
    }

    // Find the Debugger.Frame of the given FrameActor.
    let frame = null, frameActor = null;
    if (aOptions.frameActor) {
      frameActor = this.conn.getActor(aOptions.frameActor);
      if (frameActor) {
        frame = frameActor.frame;
      }
      else {
        DevToolsUtils.reportException("evalWithDebugger",
          Error("The frame actor was not found: " + aOptions.frameActor));
      }
    }

    // If we've been given a frame actor in whose scope we should evaluate the
    // expression, be sure to use that frame's Debugger (that is, the JavaScript
    // debugger's Debugger) for the whole operation, not the console's Debugger.
    // (One Debugger will treat a different Debugger's Debugger.Object instances
    // as ordinary objects, not as references to be followed, so mixing
    // debuggers causes strange behaviors.)
    let dbg = frame ? frameActor.threadActor.dbg : this.dbg;
    let dbgWindow = dbg.makeGlobalObjectReference(this.evalWindow);

    // If we have an object to bind to |_self|, create a Debugger.Object
    // referring to that object, belonging to dbg.
    let bindSelf = null;
github joewalker / devtools.html / server / actors / webconsole.js View on Github external
onAutocomplete: function WCA_onAutocomplete(aRequest)
  {
    let frameActorId = aRequest.frameActor;
    let dbgObject = null;
    let environment = null;

    // This is the case of the paused debugger
    if (frameActorId) {
      let frameActor = this.conn.getActor(frameActorId);
      if (frameActor) {
        let frame = frameActor.frame;
        environment = frame.environment;
      }
      else {
        DevToolsUtils.reportException("onAutocomplete",
          Error("The frame actor was not found: " + frameActorId));
      }
    }
    // This is the general case (non-paused debugger)
    else {
      dbgObject = this.dbg.makeGlobalObjectReference(this.evalWindow);
    }

    let result = JSPropertyProvider(dbgObject, environment, aRequest.text,
                                    aRequest.cursor, frameActorId) || {};
    let matches = result.matches || [];
    let reqText = aRequest.text.substr(0, aRequest.cursor);

    // We consider '$' as alphanumerc because it is used in the names of some
    // helper functions.
    let lastNonAlphaIsDot = /[.][a-zA-Z0-9$]*$/.test(reqText);
github joewalker / devtools.html / shared / webconsole / network-helper.js View on Github external
// always be considered insecure
        info.state = "insecure";
      } else if (state & wpl.STATE_IS_SECURE) {
        // The connection is secure if the scheme is sufficient
        info.state = "secure";
      } else if (state & wpl.STATE_IS_BROKEN) {
        // The connection is not secure, there was no error but there's some
        // minor security issues.
        info.state = "weak";
        info.weaknessReasons = this.getReasonsForWeakness(state);
      } else if (state & wpl.STATE_IS_INSECURE) {
        // This was most likely an https request that was aborted before
        // validation. Return info as info.state = insecure.
        return info;
      } else {
        DevToolsUtils.reportException("NetworkHelper.parseSecurityInfo",
          "Security state " + state + " has no known STATE_IS_* flags.");
        return info;
      }

      // Cipher suite.
      info.cipherSuite = SSLStatus.cipherName;

      // Protocol version.
      info.protocolVersion = this.formatSecurityProtocol(SSLStatus.protocolVersion);

      // Certificate.
      info.cert = this.parseCertificateInfo(SSLStatus.serverCert);

      // HSTS and HPKP if available.
      if (httpActivity.hostname) {
        const sss = Cc("@mozilla.org/ssservice;1")
github joewalker / devtools.html / shared / client / main.js View on Github external
onPacket: function (aPacket) {
    if (!aPacket.from) {
      DevToolsUtils.reportException(
        "onPacket",
        new Error("Server did not specify an actor, dropping packet: " +
                  JSON.stringify(aPacket)));
      return;
    }

    // If we have a registered Front for this actor, let it handle the packet
    // and skip all the rest of this unpleasantness.
    let front = this.getActor(aPacket.from);
    if (front) {
      front.onPacket(aPacket);
      return;
    }

    if (this._clients.has(aPacket.from) && aPacket.type) {
      let client = this._clients.get(aPacket.from);
github joewalker / devtools.html / server / actors / webconsole.js View on Github external
      sources: () => DevToolsUtils.reportException("WebConsoleActor",
        Error("sources not yet implemented")),
      createEnvironmentActor: (env) => this.createEnvironmentActor(env),
github joewalker / devtools.html / shared / webconsole / client.js View on Github external
longStringClient.substring(initial.length, length, aResponse => {
      if (aResponse.error) {
        DevToolsUtils.reportException("getString",
            aResponse.error + ": " + aResponse.message);

        deferred.reject(aResponse);
        return;
      }
      deferred.resolve(initial + aResponse.substring);
    });
github joewalker / devtools.html / client / shared / redux / middleware / task.js View on Github external
executeSoon(() => {
    reportException(ERROR_TYPE, error);
    dispatch({ type: ERROR_TYPE, error });
  });
}
github joewalker / devtools.html / shared / webconsole / network-helper.js View on Github external
formatSecurityProtocol: function NH_formatSecurityProtocol(version) {
    switch (version) {
      case Ci.nsISSLStatus.TLS_VERSION_1:
        return "TLSv1";
      case Ci.nsISSLStatus.TLS_VERSION_1_1:
        return "TLSv1.1";
      case Ci.nsISSLStatus.TLS_VERSION_1_2:
        return "TLSv1.2";
      default:
        DevToolsUtils.reportException("NetworkHelper.formatSecurityProtocol",
          "protocolVersion " + version + " is unknown.");
        return "Unknown";
    }
  },
github joewalker / devtools.html / server / actors / promises.js View on Github external
      createEnvironmentActor: () => DevToolsUtils.reportException(
        "PromisesActor", Error("createEnvironmentActor not yet implemented")),
      getGlobalDebugObject: () => DevToolsUtils.reportException(
github joewalker / devtools.html / shared / security / socket.js View on Github external
deferred.promise.catch(e => {
    if (input) {
      input.close();
    }
    if (output) {
      output.close();
    }
    DevToolsUtils.reportException("_attemptConnect", e);
  });