Ferdi: Considering BrowserViews

Created on 15 Jan 2020  路  8Comments  路  Source: getferdi/ferdi

It might be worth to consider using Electron BrowserViews instead of webviews. Here are some reasons why it might be a good idea

Warning from the webviw documentation (link)

Electron's webview tag is based on Chromium's webview, which is undergoing dramatic architectural changes. This impacts the stability of webviews, including rendering, navigation, and event routing. We currently recommend to not use the webview tag and to consider alternatives, like iframe, Electron's BrowserView, or an architecture that avoids embedded content altogether.

Performance

I've seen some articles mention improved performance, though I'm not sure how significant this is if at all. Worth looking into though, as it could help with #62.

Find-in-page

BrowserViews have a webContents property with a findInPage method. That can help with #67.

Experimental

Even though the webview documentation recommends using BrowserViews over webviews, they are marked as experimental.

wontfix but contributions are welcome

Most helpful comment

It looks like BrowserViews supports all features Ferdi needs to work! Ferdi uses react-electron-web-view to manage the web view. I just created react-electron-browser-view which should allow us to pretty much simply swap out those package to switch to BrowserViews.

Related: https://github.com/getferdi/ferdi/blob/09b961828168f8ab5a2052e0c9072d55cd1cfafc/src/components/services/content/ServiceWebview.js#L58-L79

All 8 comments

Does BrowserView still only support one view at a time? I looks into this a couple of months ago but Electron only allowed for one view to exist at a time, which would not be ideal as users want to keep their other services alive in the background so they can continue where they were.

I would assume so. It says it was added in the Electron 5.0 changelog (by this PR), and I can't find any mention of it being removed in 6.0 or 7.0.

It looks like BrowserViews supports all features Ferdi needs to work! Ferdi uses react-electron-web-view to manage the web view. I just created react-electron-browser-view which should allow us to pretty much simply swap out those package to switch to BrowserViews.

Related: https://github.com/getferdi/ferdi/blob/09b961828168f8ab5a2052e0c9072d55cd1cfafc/src/components/services/content/ServiceWebview.js#L58-L79

@vantezzen Very well done! 馃挭

Just as an update: I am currently trying to change Ferdi to using BrowserViews but here are some problems I am facing:

  • BrowserViews are only overlaid over the page. Due to this, we can't have modals like the settings overlay the BrowserView. The only way to fix this is by hiding the BrowserView as soon as we open the settings.
  • The BrowserView - for some reason - only switches really slow between services. This way, when I try to switch services it takes 2-3 seconds to switch. I don't currently know where this delay is coming from as I can hide and show BrowserViews instantly in the demo application I created for react-electron-browser-view.

For the overlays, maybe one of these would work

  • Create new BrowserView for the overlays
  • Create separate windows for overlays
  • Have the overlays act as their own tabs/services, so they take up the whole screen (probably not great for quick switch)

Moving overlays to new BrowserViews/windows/tabs would require major rewrites inside Ferdi as this this would require the modal plus their functionality to be moved into new pages and would also require us to create a method for these different pages to communicate and live-update.
These changes would also need to be kept updated every time we sync with Franz - so I don't think this is a real option.

I think our only option is to hide the BrowserViews as soon as an overlay opens.

Additionally, in my short tests while developing it looks like BrowserViews don't actually improve Ferdi's performance a lot - but I havn't done enough tests yet.
Another improvement you mentioned about BrowserViews is that they offer findInPage functionality: webviews also offer this. The reason it isn't implement yet is because it requires additional logic and design inside Ferdi - this isn't different with BrowserViews.
I don't really know if BrowserViews actually have enough improvements over webviews that we can justify switching.

I would like to find a BrowserView simple example Browser .
Can someone aim me in the right direection .
Thanks for your Help...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webworker01 picture webworker01  路  3Comments

PeSader picture PeSader  路  3Comments

sschaefa picture sschaefa  路  3Comments

alegiglio picture alegiglio  路  3Comments

probablykasper picture probablykasper  路  4Comments