This document explains the fix for the link saving functionality in the RDEX extension.
The extension had two main issues:
- Toolbar Button & Context Menu: After saving one external page, subsequent pages were not being added.
- Plus Button in Extension: Clicking the "+" button in the extension's new tab page would save the extension page URL repeatedly instead of the intended tab.
- Storage Handling: Browser storage wasn't properly synchronizing between the background script and the extension page.
- Extension URL Detection: The extension wasn't properly detecting when it was trying to save its own URL.
- Tab Query Issues: When capturing tabs from the extension page, it was only capturing itself rather than the previously visited page.
- Message Handling: Messages between different parts of the extension weren't properly processed.
-
Background Script Improvements:
- Added proper handling of the
captureActiveTabmessage - Improved detection of extension pages to prevent saving them
- Added fallback to find most recently accessed external tab
- Added broadcast messaging to update all extension pages
- Added proper handling of the
-
Extension UI Script Fixes:
- Modified
captureCurrentTab()to use background script for capturing - Added extension page detection to prevent self-capture
- Implemented user feedback when trying to save extension pages
- Added listener for link update messages from background script
- Modified
-
Content Script Enhancements:
- Added direct keyboard shortcut support for saving current page
- Improved messaging to background script
-
External Page Saving:
- Open a regular web page and click the toolbar button - it should save correctly
- Open a second web page and click the toolbar button - it should also save correctly
- Both links should appear in the dashboard when opening a new tab
-
Extension Page:
- When on the extension page, clicking the "+" button should now show a message explaining that you need to use the toolbar button/context menu for external pages
- It will attempt to save your most recently accessed external tab instead
-
Cross-Browser Testing:
- Test in Firefox, Chrome, and Edge to verify compatibility
These fixes ensure that links are properly saved to storage, persist between sessions, and are properly synchronized across all parts of the extension. The improved error handling and user feedback also make the extension more robust and user-friendly.