Welcome Guest Search | Active Topics | Sign In | Register

Web Worker Options
David Robinson
Posted: Monday, May 4, 2020 4:29:30 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
Is a Web Worker supposed to work in EO.WebBrowser?

I call new Worker(path) and it succeeds but even if the worker js file is empty, the Dev Tools window is blank and as best I can tell everything is hung. Alerts and console.log in the worker js file do not appear to execute.

Running EO.WebBrowser 19.1.40.0
Thanks
David
eo_support
Posted: Tuesday, May 5, 2020 5:58:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Web Worker has been supported by the Chromium browser engine since very early. We tested our latest build with this Web Worker sample and it works fine:

https://github.com/mdn/simple-web-worker

Note that you will need to put the files on a Web Server to test it. It won't run from local files.

Thanks!
David Robinson
Posted: Tuesday, May 5, 2020 6:32:27 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
Ouch. I need it to run from local files since everything else is... I even have cross-origin disabled with the BrowserOption EnableWebSecurity = False.
eo_support
Posted: Wednesday, May 6, 2020 8:55:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

This is an restriction imposed by the Chromium engine but if you search online you should be able to find many workaround. The easiest workaround is to add "--allow-file-access-from-files" command line argument (with security implication of course). This would translate to the following code with EO.WebBrowser:

Code: C#
EO.WebEngine.EngineOptions.Default.ExtraCommandLineArgs = "--allow-file-access-from-files";


You can add this code to App.xaml.cs in the TabbedBrowser sample application before creating MainWindow and Web Worker should work from local files.

Thanks!
David Robinson
Posted: Wednesday, May 6, 2020 11:37:07 AM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
My app is in WinForms with a DevTools panel. I tried the ExtraCommandLineArgs above and it still hangs.
eo_support
Posted: Wednesday, May 6, 2020 11:46:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Whether you use WinForms or WPF doesn't matter. The core features of EO.WebBrowser are platform neutral. I would recommend you to

1. Search online for this restriction on Google Chrome browser and you should be able to find a number of workaround for this;
2. Apply the workaround with TabbedBrowser sample application and get it work first;
3. Port the workaround from TabbedBrowser sample application to your application;

Also, can you PM us your order number?

Thanks!
David Robinson
Posted: Wednesday, May 6, 2020 12:34:24 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
We would appreciate it if you would confirm yourselves that you can add a Worker to any app of yours.
All of our files from disk and they all work except for the web worker.
And the web worker is clearly being found because if I give it a bad file name, a error shows up in the console.
eo_support
Posted: Wednesday, May 6, 2020 12:45:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

We are not in a position to provide support on generic issues that also exists in Google Chrome. So you will need to find the workaround and apply them yourself. The best we can do is to point you to the right direction --- I believe we have already done so in this case.

I am not sure what you meant by "if you would confirm that you can add a Worker to any app" ---- to us whatever app does not matter. Whatever the workaround is, if it works with TabbedBrowser sample application, it will work in your app.

Thanks!
David Robinson
Posted: Tuesday, May 12, 2020 9:56:19 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
Hi,
I apologise for pointing the finger at Web Worker. With a simple test, I have found that it works as you suggested. Thank you and sorry.

The real problem seems to be that I am trying to access eoapi in the web worker. Should that work?

I have an EO WebBrowser front end over a .NET application and it seems that the application can get busy doing internal processing and SQL access. If I can access eoapi in a web worker, then I think the .NET code would be running in a different thread from the UI. (Is that correct?)

Thank you for your patience,
David
eo_support
Posted: Wednesday, May 13, 2020 12:48:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

eoapi does not have anything to do with WebWorker. Global variable "eoapi" is in fact a member of your window object, which object does not exist in a WebWorker, so neither eoapi would exist in a WebWorker.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.