diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 20:41:42 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 20:41:42 +0000 |
commit | e811162117c95c46d555d5241f68f6e8378fc391 (patch) | |
tree | 24eed8938f71150682163c823eb83f91f842f5a9 /chrome/browser/instant | |
parent | 19e38d78c183dd3e3140237fa9acdb7fc157f5d1 (diff) | |
download | chromium_src-e811162117c95c46d555d5241f68f6e8378fc391.zip chromium_src-e811162117c95c46d555d5241f68f6e8378fc391.tar.gz chromium_src-e811162117c95c46d555d5241f68f6e8378fc391.tar.bz2 |
Fixes crash if instant is enabled and you block JS.
BUG=76077
TEST=see bug
R=tonyg@chromium.org
Review URL: http://codereview.chromium.org/6677030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r-- | chrome/browser/instant/instant_browsertest.cc | 15 | ||||
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 1ecce31..26d4006 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_window.h" +#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/instant/instant_loader.h" #include "chrome/browser/instant/instant_loader_manager.h" @@ -725,3 +726,17 @@ IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteDelayed) { EXPECT_EQ(INSTANT_COMPLETE_DELAYED, edit_model->instant_complete_behavior()); ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText()); } + +// Make sure the renderer doesn't crash if javascript is blocked. +IN_PROC_BROWSER_TEST_F(InstantTest, DontCrashOnBlockedJS) { + browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( + CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); + ASSERT_TRUE(test_server()->Start()); + EnableInstant(); + ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); + ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); + // Wait for notification that the instant API has been determined. + ui_test_utils::WaitForNotification( + NotificationType::INSTANT_SUPPORT_DETERMINED); + // As long as we get the notification we're good (the renderer didn't crash). +} diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index a22e1c4..0194765 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -544,6 +544,12 @@ void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined( page_id != source->controller().GetActiveEntry()->page_id()) return; + Details<const bool> details(&result); + NotificationService::current()->Notify( + NotificationType::INSTANT_SUPPORT_DETERMINED, + NotificationService::AllSources(), + details); + if (result) loader_->PageFinishedLoading(); else |