summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 19:55:00 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 19:55:00 +0000
commit4051732d27f9bba0d85d71c8cfb0049dce2fd906 (patch)
treeee09dae69fb9fbb40f9b148c44f711ff72244a53 /chrome/browser/instant
parent48f40b2ab482fbf21109fbf396fb43d2285e6f75 (diff)
downloadchromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.zip
chromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.tar.gz
chromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.tar.bz2
Fixes bug in instant where if the search provider didn't support
instant we would destroy the TabContents from a callback from the TabContents, which can cause problems. BUG=76077 TEST=see bug, also covered by test R=jcivelli@chromium.org Review URL: http://codereview.chromium.org/6665058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r--chrome/browser/instant/instant_browsertest.cc8
-rw-r--r--chrome/browser/instant/instant_controller.cc11
2 files changed, 8 insertions, 11 deletions
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index f57a214..26d4006 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -728,13 +728,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteDelayed) {
}
// Make sure the renderer doesn't crash if javascript is blocked.
-// Disabled on max/linuc, see 76283.
-#if defined(OS_MACOSX) || defined(OS_LINUX)
-#define MAYBE_DontCrashOnBlockedJS DISABLED_DontCrashOnBlockedJS
-#else
-#define MAYBE_DontCrashOnBlockedJS DontCrashOnBlockedJS
-#endif
-IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_DontCrashOnBlockedJS) {
+IN_PROC_BROWSER_TEST_F(InstantTest, DontCrashOnBlockedJS) {
browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
ASSERT_TRUE(test_server()->Start());
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 50f833b..c7b7494 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -425,12 +425,15 @@ void InstantController::InstantLoaderDoesntSupportInstant(
// Don't attempt to use instant for this search engine again.
BlacklistFromInstant(loader->template_url_id());
- if (loader_manager_->active_loader() == loader) {
- // The loader is active, hide all.
+ // Because of the state of the stack we can't destroy the loader now.
+ bool was_pending = loader_manager_->pending_loader() == loader;
+ ScheduleDestroy(loader_manager_->ReleaseLoader(loader));
+ if (was_pending) {
+ // |loader| was the pending loader. We may be showing another TabContents to
+ // the user (what was current). Destroy it.
DestroyPreviewContentsAndLeaveActive();
} else {
- scoped_ptr<InstantLoader> owned_loader(
- loader_manager_->ReleaseLoader(loader));
+ // |loader| wasn't pending, yet it may still be the displayed loader.
UpdateDisplayableLoader();
}
}