Opened 5 years ago

Closed 5 years ago

#14877 closed defect (fixed)

wxWebView IE backend doesn't handle HTTP error codes

Reported by: HansR Owned by:
Priority: normal Milestone:
Component: WebView Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes


While testing the IE webview backend, I noticed that attempting to access a URL that returns a 404 error doesn't result in an wxWEB_NAV_ERR_NOT_FOUND error, as would be expected. The reason is that the code in wxWebViewIE::onActiveXEvent() only processes URL moniker error codes, whereas IE can return both HTTP error codes and URL moniker error codes. Indeed, the error code being provided was 404.

See the following MSDN page for details:

Attachments (2)

webview_ie.cpp.patch download (4.2 KB) - added by HansR 5 years ago.
Simple patch to handle HTTP error codes
errorcodes.patch download (32.4 KB) - added by steve_lamerton 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by HansR

Simple patch to handle HTTP error codes

comment:1 Changed 5 years ago by HansR

The attached patch is a quick and dirty fix for this problem.

IMPORTANT: You may want to double-check the HTTP error code to wxWebViewNavigationError mappings. I wasn't sure about some of them.

Maybe it would be helpful if there were more navigation error types defined to cover more of the different possible errors.

comment:2 Changed 5 years ago by vadz

  • Patch set

I think there should be a way to get the numerical value of the HTTP error somehow.

Concerning the patch, I also think it would be better to use a table dispatch (i.e. put the HTTP and corresponding wx error codes in an array) than such extremely long switch.

Changed 5 years ago by steve_lamerton

comment:3 Changed 5 years ago by steve_lamerton

Thanks for your patch, I have uploaded a patch a number of changes. Notably it uses a macro to auto-stringify the error name. It also uses the extra long parameter to store the http status code if available. It might be better to add a new function for it though?

I agree with adding more navigation error types, do you have any specifically in mind?

I'll change the ERRORTOWX name as well before committing!

comment:4 Changed 5 years ago by SJL

  • Resolution set to fixed
  • Status changed from new to closed

(In [73325]) Add handling of http errors to wxWebViewIE. Tidy up existing large case statement.

Closes #14877.

Note: See TracTickets for help on using tickets.