Merge pull request #20936 from Snuffleupagus/debugger-getPageIndex

[Debugger] Allow debugging page-rendering from the /Ref, in addition to the page number
This commit is contained in:
calixteman 2026-03-21 13:45:39 +01:00 committed by GitHub
commit b6c9b12de0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -230,6 +230,15 @@ gotoInput.addEventListener("keydown", async ({ key, target }) => {
return;
}
target.removeAttribute("aria-invalid");
// Allow debugging via references, as well as page numbers.
if (result.page === undefined) {
try {
result.page =
pdfDoc.cachedPageNumber(result.ref) ??
(await pdfDoc.getPageIndex(result.ref)) + 1;
} catch {}
}
// If we're in debug view and navigating to a page, stay in debug view
// without switching to the tree at all.
if (!debugViewEl.hidden && result.page !== undefined) {