commit 63383fd1ab7f139f196de49f050520da1eae6536
parent 7cfef661b87ad8cb294317c5dd2f248b1fead088
Author: Markus Stange <mstange.moz@gmail.com>
Date: Mon, 10 Nov 2025 16:11:46 +0000
Bug 1987761 - In Firefox symbol files, use github source file paths instead of hg.mozilla.org paths when possible. r=gsvelto
This should speed up the source view in the Firefox Profiler, since github appears
to be faster at serving raw files than our hg server.
Differential Revision: https://phabricator.services.mozilla.com/D271691
Diffstat:
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/toolkit/crashreporter/tools/symbolstore.py b/toolkit/crashreporter/tools/symbolstore.py
@@ -320,11 +320,27 @@ def IsInDir(file, dir):
return False
+def TryGetGitRepoInfoFromHg(srcdir):
+ rev = os.environ.get("MOZ_SOURCE_CHANGESET")
+ if rev:
+ git_commit = read_output(
+ "hg", "-R", srcdir, "log", "-r", rev, "-T", "{extras.git_commit}"
+ )
+ if git_commit:
+ git_root = "https://github.com/mozilla/firefox"
+ return GitRepoInfo(srcdir, git_commit, git_root)
+ return None
+
+
def GetVCSFilenameFromSrcdir(file, srcdir):
if srcdir not in Dumper.srcdirRepoInfo:
- # Not in cache, so find it adnd cache it
+ # Not in cache, so find it and cache it
if os.path.isdir(os.path.join(srcdir, ".hg")):
- Dumper.srcdirRepoInfo[srcdir] = HGRepoInfo(srcdir)
+ git_repo_info = TryGetGitRepoInfoFromHg(srcdir)
+ if git_repo_info:
+ Dumper.srcdirRepoInfo[srcdir] = git_repo_info
+ else:
+ Dumper.srcdirRepoInfo[srcdir] = HGRepoInfo(srcdir)
else:
# Unknown VCS or file is not in a repo.
return None
@@ -434,6 +450,7 @@ def SourceIndex(fileStream, outputPath, vcs_root, s3_bucket):
+ "SRCSRV: variables ------------------------------------------\r\n"
+ "SRCSRVVERCTRL=http\r\n"
+ "RUST_GITHUB_TARGET=https://github.com/rust-lang/rust/raw/%var4%/%var3%\r\n"
+ + "FIREFOX_GITHUB_TARGET=https://github.com/mozilla/firefox/raw/%var4%/%var3%\r\n"
)
pdbStreamFile.write("HGSERVER=" + vcs_root + "\r\n")
pdbStreamFile.write("HG_TARGET=%hgserver%/raw-file/%var4%/%var3%\r\n")
@@ -443,7 +460,7 @@ def SourceIndex(fileStream, outputPath, vcs_root, s3_bucket):
pdbStreamFile.write("S3_TARGET=https://%s3_bucket%.s3.amazonaws.com/%var3%\r\n")
# Allow each entry to choose its template via "var2".
- # Possible values for var2 are: HG_TARGET / S3_TARGET / RUST_GITHUB_TARGET
+ # Possible values for var2 are: HG_TARGET / S3_TARGET / RUST_GITHUB_TARGET / FIREFOX_GITHUB_TARGET
pdbStreamFile.write("SRCSRVTRG=%fnvar%(%var2%)\r\n")
pdbStreamFile.write(
@@ -695,6 +712,10 @@ class Dumper:
(vcs, repo, source_file, revision) = filename.split(":", 3)
sourceFileStream += sourcepath + "*RUST_GITHUB_TARGET*"
sourceFileStream += source_file + "*" + revision + "\r\n"
+ elif filename.startswith("git:github.com/mozilla/firefox:"):
+ (vcs, repo, source_file, revision) = filename.split(":", 3)
+ sourceFileStream += sourcepath + "*FIREFOX_GITHUB_TARGET*"
+ sourceFileStream += source_file + "*" + revision + "\r\n"
f.write("FILE %s %s\n" % (index, filename))
elif line.startswith("INFO CODE_ID "):
# INFO CODE_ID code_id code_file