CEF not loading images

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CEF not loading images

Postby dgarrett » Tue Jul 06, 2010 8:00 pm

Hello, I am attempting to embed Chrome using CEF into an application which contains a localhost web server and I have run into a problem that looks like a security issue/configuration. When I run standard Chrome browser to communicate with the localhost web server every thing works fine, but when I use CEF I have an issue loading the initial page. What happens is this, everything starts to load, HTML, CSS, JS files, just fine, then when a JS file requests an image to load (PNG file) the web server returns it correctly, but the CEF embedded browser does not display it and stops making HTTP request for the additional image files that comprise the initial web page. Is there a limitation on loading a binary file into the CEF embedded browser while running localhost domain? I tried running the CEF browser sample app (cefclient) on other laptop all the while communicating with my web server running on a different machine and I still run in to this problem. Like I said running standard Chrome browser ( http://www.google.com/chrome/index.html ... _medium=ha ) it works fine, no issues. Any other ideas to help troubleshoot this issue would be greatly appreciated, thanks. And one more thing, I have been trying different versions of the Chromium/CEF source code all with the same results.
dgarrett
Newbie
 
Posts: 4
Joined: Tue Jul 06, 2010 7:44 pm

Re: CEF not loading images

Postby magreenblatt » Wed Jul 07, 2010 8:45 am

I've used CEF to communicate with servers running on localhost and have experienced no issues. It could potentially be an issue related to your server or your content. You might want to try the following:

1. Upload your content to a domain host and see if CEF can load the content successfully from there.
2. Try a different web server (I would recommend Apache). This can be an especially important test if you wrote your own server.

Regards,
Marshall
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: CEF not loading images

Postby dgarrett » Wed Jul 07, 2010 10:56 am

Thanks Marshall,

What might be the difference between CEF and Chrome browser with regards to this issue? When I use Chrome to communicate to my web server the content is loaded just fine. My next step is to look at the js code to see if there was an exception when the image was returned to CEF. Is there any debug plug-in or other mechanism for CEF to get debugging info regarding the HTTP request and responses? I am not that familiar with the CEF source code and if I can debug JS code while running in Visual Studio. I have performed this before with IE but just not sure how to hook into V8 to make it happen.
dgarrett
Newbie
 
Posts: 4
Joined: Tue Jul 06, 2010 7:44 pm

Re: CEF not loading images

Postby magreenblatt » Wed Jul 07, 2010 11:34 am

Code: Select all
What might be the difference between CEF and Chrome browser with regards to this issue?

There are quite a few implementation differences between CEF and the Chrome browser. The potential difference in Chromium revision between the CEF build and the Chrome browser build can also have an effect in regards to bug fixes, implemented features, etc. The latest version of CEF in the source repository supports logging of console messages including JS errors. So, if you've tried the previous tests, this is what I would recommend next:

1. Build CEF from source code and see if any JS errors are logged.
2. If no JS errors are logged then build the Chromium test_shell application and see if you can reproduce the problem with that application.
3. If it fails in test_shell then update to Chromium HEAD, build test_shell again, and see if it's still failing. If it fails in test_shell at the CEF revision but succeeds at the Chromium HEAD revision then it will likely be fixed with the next CEF update. If it fails in test_shell at the Chromium HEAD revision then create a reduced test case and file a bug with Chromium.
4. If it succeeds in test_shell at the CEF revision then it's potentially a bug in CEF. In that case create a reduced test case and file a bug with CEF.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: CEF not loading images

Postby dgarrett » Wed Jul 07, 2010 12:34 pm

Thanks, that is good to know about the logging of errors because there was one generated and it is reproducible:

[0707/102308:ERROR:http_cache_transaction.cc(1719)] failed to write response data to cache

The http_cache_transaction.cc file was from yesterdays sync on an open green tree. I am assuming the 1719 is the line number in the source file. I will build and run a cefcleint and step through this code to see what I can, but if you have seen this before...

int HttpCache::Transaction::WriteToEntry(int index, int offset,
IOBuffer* data, int data_len,
CompletionCallback* callback) {
if (!entry_)
return data_len;

int rv = 0;
if (!partial_.get() || !data_len) {
rv = entry_->disk_entry->WriteData(index, offset, data, data_len, callback,
true);
} else {
rv = partial_->CacheWrite(entry_->disk_entry, data, data_len, callback);
}

if (rv != ERR_IO_PENDING && rv != data_len) {
DLOG(ERROR) << "failed to write response data to cache";
DoneWritingToEntry(false);

// We want to ignore errors writing to disk and just keep reading from
// the network.
rv = data_len;
}
return rv;
}
dgarrett
Newbie
 
Posts: 4
Joined: Tue Jul 06, 2010 7:44 pm

Re: CEF not loading images

Postby dgarrett » Wed Jul 07, 2010 2:46 pm

Hello again,

It seems that when my web server closes the socket, after sending the HTTP response back to CEF, is when the problem occurs. When the web server does this, the size parameter in WriteToEntry() is a large negative number, 0xFFFFFF9C. based on the call stack this was due to the socket being closed and the handler times out on it. I am not sure if the value is a error code or what but some how in the Chromium code it ends up being used as a size value. So it was not an issue with images after all. The js file that was returned to CEF, just before the first image was requested, was 340k in size and it looks like CEF was still processing the byte stream with the web server closed the socket, which was right after a send() on the winsock API call. The web server is one that I wrote so I will need to pay closer attention to the HTTP spec.
dgarrett
Newbie
 
Posts: 4
Joined: Tue Jul 06, 2010 7:44 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 47 guests