Skip to content

fix(contextMenus/global_context_search): add error handling, improve menu title, and fix tab crash#1655

Open
IshitaSingh0822 wants to merge 1 commit intoGoogleChrome:mainfrom
IshitaSingh0822:fix/context-menu-error-handling
Open

fix(contextMenus/global_context_search): add error handling, improve menu title, and fix tab crash#1655
IshitaSingh0822 wants to merge 1 commit intoGoogleChrome:mainfrom
IshitaSingh0822:fix/context-menu-error-handling

Conversation

@IshitaSingh0822
Copy link
Copy Markdown

Summary

This PR improves the global_context_search context menu extension with bug fixes,
better error handling, and a UX improvement to menu item titles.

Changes

manifest.json

  • Bumped version from 1.1 to 1.2
  • Improved extension description to be more user-facing
  • Added "tabs" permission (required for safe tab creation)

background.js

  • Added error callbacks to contextMenus.create and contextMenus.remove
    with chrome.runtime.lastError checks — previously errors were silently ignored
  • Updated context menu item title to Search Google ${locale} for "%s"
    so users can see what they're searching before clicking
  • Fixed a crash when tab is undefined (e.g. on chrome:// pages)
    by conditionally spreading index only when tab is available
  • Minor comment typo fix: "removes" → "remove"

Testing

  • Loaded extension via chrome://extensions/ in developer mode
  • Verified context menu appears on text selection with correct titles
  • Verified clicking a menu item opens the correct regional Google search in a new tab
  • Verified no errors in the service worker DevTools console
  • Passed ESLint with zero errors

@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@IshitaSingh0822
Copy link
Copy Markdown
Author

Hi maintainers, just a gentle reminder for review.
Thanks!

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