Skip to content

Commit

Permalink
renderer: generate net error strings when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed May 21, 2016
1 parent 8821cae commit c9b314d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions atom/renderer/atom_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "atom/renderer/guest_view_container.h"
#include "atom/renderer/node_array_buffer_bridge.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/renderer/media/chrome_key_systems.h"
#include "chrome/renderer/pepper/pepper_helper.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
Expand All @@ -28,6 +29,7 @@
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/public/web/WebCustomElement.h"
#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
Expand Down Expand Up @@ -252,4 +254,16 @@ void AtomRendererClient::AddKeySystems(
AddChromeKeySystems(key_systems);
}

void AtomRendererClient::GetNavigationErrorStrings(
content::RenderFrame* render_frame,
const blink::WebURLRequest& failed_request,
const blink::WebURLError& error,
std::string* error_html,
base::string16* error_description) {
if (!error_description)
return;

*error_description = base::UTF8ToUTF16(net::ErrorToShortString(error.reason));
}

} // namespace atom
5 changes: 5 additions & 0 deletions atom/renderer/atom_renderer_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class AtomRendererClient : public content::ContentRendererClient,
const std::string& mime_type,
const GURL& original_url) override;
void AddKeySystems(std::vector<media::KeySystemInfo>* key_systems) override;
void GetNavigationErrorStrings(content::RenderFrame* render_frame,
const blink::WebURLRequest& failed_request,
const blink::WebURLError& error,
std::string* error_html,
base::string16* error_description) override;

scoped_ptr<NodeBindings> node_bindings_;
scoped_ptr<AtomBindings> atom_bindings_;
Expand Down
1 change: 1 addition & 0 deletions spec/api-browser-window-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('browser-window module', function () {
it('should emit did-fail-load event for files that do not exist', function (done) {
w.webContents.on('did-fail-load', function (event, code, desc, url, isMainFrame) {
assert.equal(code, -6)
assert.equal(desc, 'ERR_FILE_NOT_FOUND')
assert.equal(isMainFrame, true)
done()
})
Expand Down

0 comments on commit c9b314d

Please sign in to comment.