Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Issue with Custom Scheme and ResourceHandler Options
James
Posted: Monday, August 17, 2020 3:55:52 PM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 120
I've been dealing with a problem which I now believe may be a bug in EO's web browser, brought on by the latest Chromium update to 81.

I use a custom scheme to redirect resources under certain conditions, we allow an application and certain file types associated with our software to provide a standard web url with our custom scheme, lets call the scheme example.

I was able to reproduce this problem in the TabbedBrowser_CS sample provided with EO Total 2020
I added the following resource handler to the project
Code: C#
using EO.WebBrowser;
using System;

namespace EO.TabbedBrowser
{
    public class ExampleResourceHandler : ResourceHandler
    {
        public sealed override bool Match(Request request) =>
                request.Url.StartsWith("example", StringComparison.OrdinalIgnoreCase)
             || request.Url.StartsWith("examples", StringComparison.OrdinalIgnoreCase);

        public override void ProcessRequest(Request request, Response response)
        {
            var uri = new Uri(request.Url);
            response.StatusCode = 301;
            response.RedirectLocation = $"http://{uri.Host}{uri.PathAndQuery}";
        }
    }
}


In the WebViewItem.cs file in the WebPage constructor I call
Code: C#
m_WebView.RegisterResourceHandler(new ExampleResourceHandler());


In App.xaml.cs I change
Code: C#
EO.WebEngine.EngineOptions.Default.RegisterCustomSchemes("sample");

to
Code: C#
EO.WebEngine.EngineOptions.Default.RegisterCustomSchemes("sample", "example", "examples");


Now if you launch the application, you can surf to any site, for example http://www.essentialobjects.com/ you'll load as expected.
If you now go into the Debug UI and open up the Chromium debugger console and enter:
Code: JavaScript
window.location = 'example://www.google.com'


the page will redirect to about:blank#blocked and the custom ResourceHandler will never be processed, neither the Match nor ProcessRequest methods get executed.

If you modify the following by removing "example" and "examples" the ResourceHandler will once again get processed, the behavior appears to be the inverse of what is expected.
Code: C#
EO.WebEngine.EngineOptions.Default.RegisterCustomSchemes("sample", "example", "examples");




eo_support
Posted: Wednesday, August 19, 2020 9:47:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,491
Hi,

We have confirmed this to be an issue. We will fix this in our next build and reply here again as soon as the new build is available.

Thanks!
James
Posted: Wednesday, August 19, 2020 12:37:39 PM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 120
Thank you for the update look forward to the patch, new update seems good overall.
James
Posted: Monday, August 31, 2020 11:10:45 AM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 120
Is there an ETA on when a patch for this will be available, we need these features and the PDF package we bought does not appear to provide the desired functionality in our current production version.
This means this bug is a blocking issue for us to use EO.PDF since we cannot break our protocol schemes to make pdf printing available.
This is also blocking a fix for an issue causing our software to crash via EO on Windows 7 machines.
eo_support
Posted: Monday, August 31, 2020 11:24:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,491
Hi,

We have already fixed this issue internally. Our next update is scheduled at the end of the second week in September (around 11th). Will that work for you?

Thanks!
James
Posted: Tuesday, September 1, 2020 2:24:59 PM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 120
This works for us as long as this date doesn't extend far past the 11th, we have a good number of users negatively impacted by these issues and want to get them resolved as soon as we can.
eo_support
Posted: Thursday, September 10, 2020 3:45:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,491
Hi,

This is just to let you know that we have posted a new build (20.2.63) that should resolve this issue. You can download the new build from our download page.

Note that the custom scheme registration only affects navigation initialized on the render side (for example, running JavaScript code to set window.location). It has no impact on navigation initialized on the browser side (such as setting WebView.Url in C#). All schemes are always allowed on the browser side (as long as a custom handler exists).

Thanks!
James
Posted: Thursday, October 15, 2020 9:42:51 AM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 120
In the latest update you've marked RegisterCustomSchemes as obsolete, is there anything that needs to be done differently now?
I did notice that not registering custom schemes before the bug was fixed would allow my custom schemes to work, is that just the expected behavior now?
eo_support
Posted: Thursday, October 15, 2020 3:54:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,491
Hi,

Nothing particular different except that you no longer need to call RegisterCustomSchemes. In the latest version custom scheme would work as long as you have a custom resource handler. If neither custom resource handler nor the built-in handler handles it, then LaunchUrl event will be called (for top level Urls).

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.