Skip to content

Latest commit

 

History

History
78 lines (60 loc) · 3.24 KB

File metadata and controls

78 lines (60 loc) · 3.24 KB

Test Results for Issue #18 Fixes

Issues Fixed

✅ 1. Extension URL Detection

Problem: Extension showed permission error on extension:// URLs
Fix: Added extension:// to isRestrictedPage() function
Result: Now properly detects extension pages as restricted

✅ 2. Better Error Messages

Problem: Generic "Cannot send from browser internal pages" error
Fix: Changed to user-friendly message
New Message: "This extension cannot send data from browser internal pages (settings, extensions, etc.). Please navigate to a regular website and try again."

✅ 3. Context Menu Consistency

Problem: Context menu worked on restricted pages while popup didn't
Fix: Added restricted page check to context menu handler
Result: Both popup and context menu now behave consistently

✅ 4. Favicon CSP/File Protocol Issues

Problem: CSP violations and errors with file:// favicons
Fix:

  • Skip file:// URLs in favicon detection
  • Proper fallback to extension icon URL
  • Keep existing onerror handler in popup for broken images

✅ 5. Linting Issues

Problem: Multiple ESLint errors in codebase
Fix: Fixed space-before-function-paren and unused variable issues

Test Scenarios

Scenario 1: Regular Website

  • URL: https://example.com
  • Expected: Extension works normally
  • Favicon: Uses site favicon or falls back properly

Scenario 2: Extension Options Page

  • URL: extension://abc123/options.html
  • Expected: Shows friendly error message
  • Behavior: Both popup and context menu show same error

Scenario 3: Chrome/Edge Internal Pages

  • URL: chrome://settings/ or edge://settings/
  • Expected: Shows friendly error message
  • Behavior: Consistent between popup and context menu

Scenario 4: Local Files

  • URL: file:///path/to/file.html
  • Expected: Extension works but favicons fall back to extension icon
  • Favicon: Skips file:// favicons, uses extension icon

Scenario 5: Pages with Broken Favicons

  • URL: Any page with non-existent favicon
  • Expected: Extension works, favicon shows extension icon in preview
  • Behavior: No console errors due to onerror handler

Key Improvements

  1. Better UX: Clear, actionable error messages
  2. Security: Proper CSP compliance for favicon handling
  3. Consistency: Same behavior across popup and context menu
  4. Reliability: Robust favicon fallback mechanism
  5. Clean Console: No more CSP violation errors in dev tools

Files Modified

  • package/utils.js: Updated isRestrictedPage() and getFavicon()
  • package/popup.js: Updated isRestrictedPage() and error message
  • package/background.js: Added context menu restriction check, fixed linting
  • test-restricted-pages.html: Created test page for validation

Technical Notes

The extension now properly handles the GitHub issue URL structure by:

  • Detecting extension://jcfjdkjadplcjlpddmbpiefkfgdaaabf/options.html as restricted
  • Falling back to https://raw.githubusercontent.com/JOHLC/Send-to-Home-Assistant/refs/heads/main/assets/icon-256.png for favicon when needed (via chrome.runtime.getURL('icon-256.png'))
  • Providing consistent, user-friendly error messages across all interaction methods