Bug 1945944: Add layout debugger startup option to turn on deterministic frame dumping by default. r=layout-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D236874
This commit is contained in:
David Shin
2025-02-06 15:34:28 +00:00
parent 3352411528
commit 233b05e46b
2 changed files with 20 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
bool captureProfile = false;
nsString profileFilename;
bool paged = false;
bool deterministicFrameDumping = false;
rv = HandleFlagWithOptionalArgument(aCmdLine, u"layoutdebug"_ns,
u"about:blank"_ns, url, flagPresent);
@@ -125,6 +126,10 @@ nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
rv = aCmdLine->HandleFlag(u"paged"_ns, false, &paged);
NS_ENSURE_SUCCESS(rv, rv);
rv = aCmdLine->HandleFlag(u"deterministic-frame-dumping"_ns, false,
&deterministicFrameDumping);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMutableArray> argsArray = nsArray::Create();
nsCOMPtr<nsIURI> uri;
@@ -161,6 +166,11 @@ nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
NS_ENSURE_SUCCESS(rv, rv);
}
if (deterministicFrameDumping) {
rv = AppendArg(argsArray, u"deterministic-frame-dumping"_ns);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIWindowWatcher> wwatch =
do_GetService(NS_WINDOWWATCHER_CONTRACTID);
NS_ENSURE_TRUE(wwatch, NS_ERROR_FAILURE);
@@ -184,6 +194,9 @@ nsLayoutDebugCLH::GetHelpInfo(nsACString& aResult) {
" Debugger using the Gecko Profiler, and save the\n"
" profile to the specified file (which defaults to\n"
" profile.json).\n"
" --paged Layout the page in paginated mode.\n");
" --paged Layout the page in paginated mode.\n"
" --deterministic-frame-dumping Toggle option to only include\n"
" deterministic information in frame dumps,\n"
" for ease of diffing.\n");
return NS_OK;
}

View File

@@ -298,6 +298,7 @@ function parseArguments() {
autoclose: false,
delay: 0,
paged: false,
deterministicFrameDumping: false,
};
if (window.arguments) {
args.url = window.arguments[0];
@@ -311,6 +312,8 @@ function parseArguments() {
args.profileFilename = RegExp.$1;
} else if (/^paged$/.test(arg)) {
args.paged = true;
} else if (/^deterministic-frame-dumping$/.test(arg)) {
args.deterministicFrameDumping = true;
} else {
throw `Unknown option ${arg}`;
}
@@ -397,6 +400,8 @@ function OnLDBLoad() {
loadStringURI(gArgs.url);
}
gDebugger._deterministicFrameDumping = gArgs.deterministicFrameDumping;
// Some command line arguments may toggle menu items. Call this after
// processing all the arguments.
checkPersistentMenus();
@@ -416,6 +421,7 @@ function checkPersistentMenus() {
checkPersistentMenu("crossingEventDumping");
checkPersistentMenu("reflowCounts");
checkPersistentMenu("pagedMode");
checkPersistentMenu("deterministicFrameDumping");
}
function dumpProfile() {