| Index: chrome/browser/ui/search/instant_controller.cc
|
| diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc
|
| index f3750445bbd275209feeefb19aff0fb50340b144..494e142879a7628ac6336fea6a86ea3cd98e41f6 100644
|
| --- a/chrome/browser/ui/search/instant_controller.cc
|
| +++ b/chrome/browser/ui/search/instant_controller.cc
|
| @@ -854,7 +854,11 @@ bool InstantController::CommitIfPossible(InstantCommitType type) {
|
| overlay_->Submit(last_omnibox_text_);
|
| }
|
|
|
| + // Make sure the overlay WebContents is in a valid state (i.e., has a last
|
| + // committed entry, no transient entry, and no existing pending entry).
|
| scoped_ptr<content::WebContents> overlay = overlay_->ReleaseContents();
|
| + if (!overlay || !overlay->GetController().CanPruneAllButVisible())
|
| + return false;
|
|
|
| // If the overlay page has navigated since the last Update(), we need to add
|
| // the navigation to history ourselves. Else, the page will navigate after
|
| @@ -894,12 +898,12 @@ bool InstantController::CommitIfPossible(InstantCommitType type) {
|
| }
|
|
|
| if (type == INSTANT_COMMIT_PRESSED_ALT_ENTER) {
|
| - overlay->GetController().PruneAllButActive();
|
| + CHECK(overlay->GetController().PruneAllButVisible());
|
| } else {
|
| content::WebContents* active_tab = browser_->GetActiveWebContents();
|
| AddSessionStorageHistogram(extended_enabled(), active_tab, overlay.get());
|
| - overlay->GetController().CopyStateFromAndPrune(
|
| - &active_tab->GetController());
|
| + CHECK(overlay->GetController().CopyStateFromAndPrune(
|
| + &active_tab->GetController()));
|
| }
|
|
|
| if (extended_enabled()) {
|
|
|