Skip to content

Commit b6c9b12

Browse files
authored
Merge pull request #20936 from Snuffleupagus/debugger-getPageIndex
[Debugger] Allow debugging page-rendering from the /Ref, in addition to the page number
2 parents e577141 + 4c05044 commit b6c9b12

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

web/internal/debugger.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ gotoInput.addEventListener("keydown", async ({ key, target }) => {
230230
return;
231231
}
232232
target.removeAttribute("aria-invalid");
233+
234+
// Allow debugging via references, as well as page numbers.
235+
if (result.page === undefined) {
236+
try {
237+
result.page =
238+
pdfDoc.cachedPageNumber(result.ref) ??
239+
(await pdfDoc.getPageIndex(result.ref)) + 1;
240+
} catch {}
241+
}
233242
// If we're in debug view and navigating to a page, stay in debug view
234243
// without switching to the tree at all.
235244
if (!debugViewEl.hidden && result.page !== undefined) {

0 commit comments

Comments
 (0)