]> khamidou — GitHub mirrors - electron.git/commitdiff
Deprecate the BrowserWindow.restart.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 29 Apr 2014 07:35:12 +0000 (15:35 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 29 Apr 2014 07:44:41 +0000 (15:44 +0800)
Now BrowserWindow.reload would just do the same thing.

atom/browser/api/atom_api_web_contents.cc
atom/browser/api/lib/browser-window.coffee
atom/browser/api/lib/web-contents.coffee
atom/browser/atom_browser_client.cc

index fcc0ea2e8855f751ee1c3c33bbf8cbdeaf20cdaf..befe17db78b958e3e0ff32b2fced33e23a725627 100644 (file)
@@ -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 {
index 7413ff8b84158d2db105f4950f8ec126296c3467..421d8842d6a7d35055494918410184456b469f2f 100644 (file)
@@ -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()
index 822f34623485b2a9d63515e2e5d398ccb7c712c4..5e721233476492a4bbaa82c7ed728b4331801494 100644 (file)
@@ -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()
index bd7d95ab47c6e21f1182bb4bdb2f17d073a21181..2c51b03b983102a0b040c55e8c1ef130d2b717f6 100644 (file)
@@ -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;
 }