samuelmaddock / electron-browser-shell

A minimal, tabbed web browser with support for Chrome extensions—built on Electron.
GNU General Public License v3.0
343 stars 67 forks source link

Support crx protocol in remote sessions #41

Open samuelmaddock opened 2 years ago

samuelmaddock commented 2 years ago

v3.9.0 introduced a crx:// protocol to serve extension icons. If the icons are loaded in a session separate from where the extensions are loaded, they will fail with net::ERR_UNKNOWN_URL_SCHEME.

Electron's protocol API is unique to each session.

A protocol is registered to a specific Electron session object. If you don't specify a session, then your protocol will be applied to the default session that Electron uses.

Registering the protocol when the remote session is interested in receiving browserAction updates is too late and would require the page to be reloaded.


This bug may be what's causing a test to fail:

not ok 17 chrome.browserAction <browser-action-list> element lists actions in remote partition
  expected [] to deeply equal [ 'admpllddodedaonjnppghnfjboamdmfn' ]
  AssertionError: expected [] to deeply equal [ 'admpllddodedaonjnppghnfjboamdmfn' ]
      at Context.<anonymous> (spec/chrome-browserAction-spec.ts:212:36)
quanglam2807 commented 2 years ago

Thank you, @samuelmaddock. I temporarily reverted the changes: https://github.com/webcatalog/neutron/pull/593. Hopefully, we can figure out a good solution for this.

How about also attaching crx protocol to the defaultSession?

Kilian commented 6 days ago

An alternative is not using crx:// at all, such as in https://github.com/fvulich/electron-chrome-extensions/commit/33f5c64d08ce51c85301055035373d9c8eaec8ed which circumvents the issue.