Skip to content

fix: report failed saves and stop clicking links during capture (v1.2.2) - #27

Merged
levz0r merged 1 commit into
developfrom
fix/save-feedback-and-no-link-clicks
Oct 29, 2026
Merged

levz0r merged 1 commit into
developfrom
fix/save-feedback-and-no-link-clicks

Conversation

@levz0r

@levz0r levz0r commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Fixes the two failures behind the recent Chrome Web Store reviews ("nothing actually happens"; "it sends me to another page").

What was wrong

  1. "Saved!" on every outcome. popup.js awaited sendMessage but never looked at response.success, so protected pages and failed captures still showed "Saved!" with no file.
  2. Capture clicked menu links. expandCollapsedSections() calls .click() on every [aria-expanded="false"], .expand, .collapsed, … element. On a menu link like <a href="/services/" aria-expanded="false">, that navigates the tab away. The injected script dies, executeScript returns no result, and background.js treated that as "user pressed Abort" and returned quietly. The result was a different page, no file, and "Saved!".

Changes

  • Popup checks the response and shows a localized reason under the button (en/fr/he/hi): protected page, page navigated, or the raw error text.
  • Background
    • Abort now returns { cancelled: true } explicitly.
    • A missing result throws a page-navigated error instead of passing as a cancel.
    • The popup gets a response even when no active tab is found.
  • New src/expand-policy.js, injected next to turndown.js. Expansion never clicks:
    • links to a different URL (same-page # and javascript: toggles are still allowed),
    • links with target/download,
    • submit buttons inside a form.
    • <details> elements are still opened.
  • Context menu: a failed save sets a red ! badge and stores the error. The popup shows it when opened, then clears it.
  • Version 1.2.2 and a CHANGELOG entry.

Verification

  • pnpm run format, lint, test: 115 tests pass, including 13 new tests for expand-policy.

  • End-to-end in headless Chromium with the built extension, old build (v1.2.1) vs this branch. The test copy adds host_permissions: <all_urls> to stand in for the activeTab grant.

    Scenario v1.2.1 this PR
    Popup on chrome://version "Saved!", 0 downloads "Error – Try again" + protected-page message
    Page with <a href="/services/" aria-expanded="false"> menu tab navigates to /services/, 0 downloads no navigation, page saved
    Page whose toggle button navigates via onclick "Saved!", 0 downloads page-navigated message
    Context-menu save on a protected page silent ! badge; popup shows the reason and clears the badge
    Abort pressed during capture no download no download, no error shown
    8 real sites (example, apple, microsoft, bbc, shopify, squarespace, wordpress.org, python.org) all saved all saved; sizes match or are within normal run-to-run variation
  • Firefox was not tested end to end. It uses the same browser.action / storage.local / scripting APIs.

🤖 Generated with Claude Code

The popup ignored the background's response and showed "Saved!" for every
outcome, including protected pages and captures that died mid-way. And
expandCollapsedSections() clicked every [aria-expanded="false"] element,
including menu links, which navigated the tab away; the capture script
then returned nothing, which background.js treated as "user cancelled".

- popup checks response.success and shows a localized reason
- background distinguishes Abort ({cancelled: true}) from a capture that
  returned nothing (page-navigated error) and answers when no tab is found
- new src/expand-policy.js: never click links to another page, links that
  open a new tab or download, or form submit buttons
- context-menu failures set a "!" badge and are shown when the popup opens

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (45ab2d7) to head (15f0d7e).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            4         4           
  Branches         1         1           
=========================================
  Hits             4         4           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@levz0r
levz0r merged commit d0d72f8 into develop Oct 29, 2026
4 checks passed
@levz0r
levz0r deleted the fix/save-feedback-and-no-link-clicks branch October 29, 2026 18:58
@levz0r levz0r mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant