in src/SourceMapToolkit.CallstackDeminifier/StackTraceParser.cs [86:131]
protected virtual string TryExtractMethodNameFromFrame(string frame)
{
string methodName = null;
// Firefox has stackframes in the form: "c@http://localhost:19220/crashcauser.min.js:1:34"
int atSymbolIndex = frame.IndexOf("@http", StringComparison.Ordinal);
if (atSymbolIndex != -1)
{
methodName = frame.Substring(0, atSymbolIndex).TrimStart();
}
else
{
// Chrome and IE11 have stackframes in the form: " at d (http://chrisgocallstack.azurewebsites.net/crashcauser.min.js:1:75)"
int atStringIndex = frame.IndexOf("at ", StringComparison.Ordinal);
if (atStringIndex != -1)
{
int httpIndex = frame.IndexOf(" (http", atStringIndex, StringComparison.Ordinal);
if (httpIndex == -1)
{
httpIndex = frame.IndexOf(" http", atStringIndex, StringComparison.Ordinal);
if (httpIndex != -1)
httpIndex++; // append one char to include a blank space to be able to replace "at " correctly
}
if (httpIndex != -1)
{
methodName = frame.Substring(atStringIndex, httpIndex - atStringIndex).Replace("at ", "").Trim();
}
else
{
var parenthesesIndex = frame.IndexOf(" (", atStringIndex, StringComparison.Ordinal);
if (parenthesesIndex != -1)
{
methodName = frame.Substring(atStringIndex, parenthesesIndex - atStringIndex).Replace("at ", "").Trim();
}
}
}
}
if (string.IsNullOrWhiteSpace(methodName))
{
methodName = null;
}
return methodName;
}