Don't close tabs from crashed extensions with background pages.
Make the crashed extension reload when the sad tab is reloaded.
('Extensions' includes packaged apps.)

BUG=71629
BUG=94177
TEST=Added ExtensionCrashRecoveryTest.ReloadTabsWithBackgroundPage. Manually: Open a packaged app with a background page. Kill it from Task Manager. Its tab should not close. Reload the tab and it should show the app (and the crash notification bubble should be gone).


Review URL: http://codereview.chromium.org/8496024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109675 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index bd34f24..bbf5f01a 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -2122,7 +2122,10 @@
   if (terminated_extension_ids_.insert(extension->id()).second)
     terminated_extensions_.push_back(make_scoped_refptr(extension));
 
-  UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_DISABLE);
+  // TODO(yoz): Listen to navcontrollers for that extension. Is this a todo?
+
+  // TODO(yoz): make sure this is okay in *ALL* the listeners!
+  UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_TERMINATE);
 }
 
 void ExtensionService::UntrackTerminatedExtension(const std::string& id) {