Frame.parseFirefox constructor

Frame.parseFirefox(String frame)

Parses a string representation of a Firefox stack frame.

Implementation

factory Frame.parseFirefox(String frame) => _catchFormatException(frame, () {
      var match = _firefoxSafariFrame.firstMatch(frame);
      if (match == null) return new UnparsedFrame(frame);

      // Normally this is a URI, but in a jsshell trace it can be a path.
      var uri = _uriOrPathToUri(match[3]);

      var member;
      if (match[1] != null) {
        member = match[1];
        member +=
            new List.filled('/'.allMatches(match[2]).length, ".<fn>").join();
        if (member == '') member = '<fn>';

        // Some Firefox members have initial dots. We remove them for consistency
        // with other platforms.
        member = member.replaceFirst(_initialDot, '');
      } else {
        member = '<fn>';
      }

      var line = match[4] == '' ? null : int.parse(match[4]);
      var column =
          match[5] == null || match[5] == '' ? null : int.parse(match[5]);
      return new Frame(uri, line, column, member);
    });