From: Cheng Zhao Date: Tue, 29 Apr 2014 07:35:12 +0000 (+0800) Subject: Deprecate the BrowserWindow.restart. X-Git-Tag: v0.12.1~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a85db2d7809e1e4d1489ebe8b75418f06c471f49;p=electron.git Deprecate the BrowserWindow.restart. Now BrowserWindow.reload would just do the same thing. --- diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index fcc0ea2e..befe17db 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -99,11 +99,14 @@ void WebContents::Stop() { } void WebContents::Reload() { - web_contents()->GetController().Reload(false); + // Navigating to a URL would always restart the renderer process, we want this + // because normal reloading will break our node integration. + // This is done by AtomBrowserClient::ShouldSwapProcessesForNavigation. + LoadURL(GetURL()); } void WebContents::ReloadIgnoringCache() { - web_contents()->GetController().ReloadIgnoringCache(false); + Reload(); } bool WebContents::CanGoBack() const { diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 7413ff8b..421d8842 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -81,7 +81,7 @@ BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments BrowserWindow::send = -> @webContents.send.apply @webContents, arguments # Be compatible with old API. -BrowserWindow::restart = -> @webContents.restart() +BrowserWindow::restart = -> @webContents.reload() BrowserWindow::getUrl = -> @webContents.getUrl() BrowserWindow::reload = -> @webContents.reload() BrowserWindow::reloadIgnoringCache = -> @webContents.reloadIgnoringCache() diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index 822f3462..5e721233 100644 --- a/atom/browser/api/lib/web-contents.coffee +++ b/atom/browser/api/lib/web-contents.coffee @@ -11,10 +11,6 @@ module.exports.wrap = (webContents) -> webContents.send = (args...) -> @_send 'ATOM_INTERNAL_MESSAGE', [args...] - # WebContents::restart() - # Restart the renderer process. - webContents.restart = -> @loadUrl @getUrl() - # The processId and routingId and identify a webContents. webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}" webContents.equal = (other) -> @getId() is other.getId() diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index bd7d95ab..2c51b03b 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -83,7 +83,8 @@ bool AtomBrowserClient::ShouldSwapProcessesForNavigation( if (site_instance->HasProcess()) dying_render_process_ = site_instance->GetProcess(); - // Restart renderer process for all navigations. + // Restart renderer process for all navigations, this relies on a patch to + // Chromium: http://git.io/_PaNyg. return true; }