From c209ea72c10d55d6e001453ab33fb5f19ea39c13 Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mr-cheffy@users.noreply.github.com> Date: Fri, 4 Sep 2026 17:51:08 +0200 Subject: [PATCH] gh-15234: Fixed issues live folders not loading (gh-15235) --- .../providers/GithubLiveFolder.sys.mjs | 57 ++++++++----------- .../browser_github_live_folder.js | 35 +++++++----- 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs b/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs index f565e7b8f..ce3ef4cb9 100644 --- a/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs +++ b/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs @@ -198,45 +198,36 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider { } const document = new DOMParser().parseFromString(text, "text/html"); - const issues = document.querySelectorAll( - "div[class^=IssueItem-module__defaultRepoContainer]" + const links = document.querySelectorAll( + 'a[data-testid="issue-listitem-title-link"]' ); const items = []; const activeRepos = new Set(); - if (issues.length) { - const authors = document.querySelectorAll( - "a[class^=IssueItem-module__authorCreatedLink]" + for (const link of links) { + const issueUrl = new URL(link.getAttribute("href"), this.state.url); + const pathMatch = issueUrl.pathname.match( + /^\/([^/]+\/[^/]+)\/(?:issues|pull)\/([0-9]+)/ ); - const titles = document.querySelectorAll( - "div[class^=Title-module__container]" - ); - const links = document.querySelectorAll( - '[data-testid="issue-pr-title-link"]' - ); - - for (let i = 0; i < issues.length; i++) { - const [rawRepo, rawNumber] = issues[i].childNodes; - const author = authors[i]?.textContent; - const title = titles[i]?.textContent; - const issueUrl = links[i]?.href; - - const repo = rawRepo.textContent?.trim(); - if (repo) { - activeRepos.add(repo); - } - - const numberMatch = rawNumber?.textContent?.match(/[0-9]+/); - const number = numberMatch?.[0] ?? ""; - - items.push({ - title, - subtitle: author, - icon: "chrome://browser/content/zen-images/favicons/github.svg", - url: "https://github.com" + issueUrl, - id: `${repo}#${number}`, - }); + if (!pathMatch) { + continue; } + + const [, repo, number] = pathMatch; + activeRepos.add(repo); + + const author = link + .closest("li") + ?.querySelector('[data-testid="author-filter-link"]') + ?.lastChild?.textContent.trim(); + + items.push({ + title: link.textContent.trim(), + subtitle: author, + icon: "chrome://browser/content/zen-images/favicons/github.svg", + url: issueUrl.href, + id: `${repo}#${number}`, + }); } return { diff --git a/src/zen/tests/live-folders/browser_github_live_folder.js b/src/zen/tests/live-folders/browser_github_live_folder.js index e56be019e..c87d181d5 100644 --- a/src/zen/tests/live-folders/browser_github_live_folder.js +++ b/src/zen/tests/live-folders/browser_github_live_folder.js @@ -130,18 +130,22 @@ add_task(async function test_html_parsing_logic() { const mockHtml = `
- - +