Skip to content

feat(browser): enable Chrome extension compatibility (webRequest, contextMenus, debugger unblock)#160

Open
PrasannaPal21 wants to merge 25 commits intop2plabsxyz:mainfrom
PrasannaPal21:Chrome-api-limitations
Open

feat(browser): enable Chrome extension compatibility (webRequest, contextMenus, debugger unblock)#160
PrasannaPal21 wants to merge 25 commits intop2plabsxyz:mainfrom
PrasannaPal21:Chrome-api-limitations

Conversation

@PrasannaPal21
Copy link
Copy Markdown
Contributor

@PrasannaPal21 PrasannaPal21 commented Mar 20, 2026

This PR improves Chrome extension compatibility on the browser side.

  • Integrated Electron webRequest with extension layer (supports all events + blocking)
  • Added support for extension context menu items in the browser
  • Unblocked chrome.debugger API
  • Fixed opening of chrome-extension:// URLs in proper tabs

Related: #125

peersky-browser-shell#4

@akhileshthite akhileshthite added enhancement New feature or request extensions Related to web extensions or chrome APIs issues labels Mar 21, 2026
@PrasannaPal21 PrasannaPal21 marked this pull request as ready for review March 24, 2026 21:06
Copilot AI review requested due to automatic review settings March 24, 2026 21:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Chrome extension compatibility in the Electron-based browser shell by bridging missing extension APIs/behaviors into the host app (notably webRequest dispatching, context menu integration, and tab/webview registration resilience).

Changes:

  • Dispatch Electron session.webRequest events into the extension layer (including blocking-capable hooks) and adjust tab/webview registration to handle guest webContents replacement.
  • Integrate extension-provided chrome.contextMenus items into the browser’s native context menu.
  • Unblock chrome.debugger permission and improve handling of chrome-extension:// URLs so they open as normal tabs instead of popups.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/main.js Adds a webRequest bridge from Electron session to the extension layer across multiple events.
src/pages/tab-bar.js Makes extension tab registration robust to webContents ID changes; adjusts popup-closing behavior on tab switches.
src/extensions/services/popup-guards.js Redirects extension window.open() of chrome-extension:// URLs to open in a normal tab.
src/context-menu.js Appends extension-provided context menu items into the app context menu.
src/extensions/policy.js Removes debugger from blocked permissions to unblock chrome.debugger.
src/extensions/index.js Minor hunk change near tab registration; logging remains in the touched area.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.js Outdated
Comment thread src/main.js
Comment thread src/main.js Outdated
Comment thread src/pages/tab-bar.js
Comment thread src/extensions/services/popup-guards.js Outdated
Comment thread src/extensions/index.js Outdated
@PrasannaPal21 PrasannaPal21 requested a review from Copilot April 6, 2026 19:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/pages/tab-bar.js:893

  • The if (!isNewTab) { ... } block’s indentation is currently inconsistent, which makes it easy to misread the scope of what is conditional (especially around the try/catch). Please reformat this block so the conditional region is unambiguous and matches the surrounding style.
      if (!isNewTab) {
      try {
        const { ipcRenderer } = require('electron');
        ipcRenderer.invoke('extensions-close-all-popups').catch(error => {
          console.warn('[TabBar] Failed to close extension popups on tab switch:', error);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/tab-bar.js Outdated
Comment thread src/extensions/services/popup-guards.js Outdated
Comment thread src/extensions/services/popup-guards.js Outdated
PrasannaPal21 and others added 5 commits April 9, 2026 23:53
indentation fix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
removed unused import

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request extensions Related to web extensions or chrome APIs issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants