createObjectURL crashes CefSharp browser if UNC path used

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

createObjectURL crashes CefSharp browser if UNC path used

Postby steveg » Thu Jun 10, 2021 3:47 am

Using CefSharp v89.0.170.0 in a Winforms application, I try to save a file using code from the code in the is file (file_saver.js) :

https://github.com/eligrey/FileSaver.js ... leSaver.js

The javascript and html files are loaded from a windows network share location. It works fine as long as the javascript files are loaded from an url html file location specified like this (non UNC):

Code: Select all
file:///G://tmp/index.html


... but if I use the windows network share UNC name for the exact same file location :

Code: Select all
file:///cit-nas1/DATA/GROUPS/ABC/tmp/index.html


... it fails at this statement, and the browser seems to crash :

a.href = URL.createObjectURL(blob)

..blob is a javscript blob with content type: text/csv;charset=utf-8
The normal functionality is just to allow saving of this text data as a file locally on the users' PC, but what actually happens is a 'blank' page in the browser and devtools get disconnected so I cannot see an error message.

In the C# application the chromium web browser is created as follows :

Code: Select all
 var browser = new ChromiumWebBrowser(url)
            {
                BrowserSettings = new BrowserSettings
                {
                    FileAccessFromFileUrls = CefState.Enabled,
                    UniversalAccessFromFileUrls = CefState.Enabled,
                    WebSecurity = CefState.Disabled,
                    TextAreaResize = CefState.Disabled
                },
                Dock = DockStyle.Fill

            };
            browser.MenuHandler = new MenuHandler();     
            browser.RequestHandler = new CoreRequestHandler();
            browser.JsDialogHandler = new JsDialogHandler();
            browser.DownloadHandler = new DownloadHandler();
            browser.LifeSpanHandler = new CustomLifeSpanHandler();
            browser.FocusHandler = new FocusHandler(browser, urlTextBox);
            browser.LoadError += OnLoadError;


I need to use the network share name. It feels like a security issue or maybe a bug. I cannot find out what to do to make it work. Can anyone offer a solution ? It worked in my previously used CefSharp v57.0.0.0 with the exact same javascript, html and c# code.
steveg
Newbie
 
Posts: 1
Joined: Thu Jun 10, 2021 3:15 am

Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 1 guest