| Index: chrome/browser/ui/browser_instant_controller.cc
|
| diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
|
| index 34e1ee717c995cf64155a0d39972e9467d70396b..226f5a0eb981c63c9e3884699f3cca87be32d4de 100644
|
| --- a/chrome/browser/ui/browser_instant_controller.cc
|
| +++ b/chrome/browser/ui/browser_instant_controller.cc
|
| @@ -94,19 +94,21 @@ bool BrowserInstantController::MaybeSwapInInstantNTPContents(
|
| return false;
|
| }
|
|
|
| + // Make sure the instant 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> instant_ntp = instant_.ReleaseNTPContents();
|
| - if (!instant_ntp)
|
| + if (!instant_ntp || !instant_ntp->GetController().CanPruneAllButVisible())
|
| return false;
|
|
|
| *target_contents = instant_ntp.get();
|
| if (source_contents) {
|
| - instant_ntp->GetController().CopyStateFromAndPrune(
|
| - &source_contents->GetController());
|
| + CHECK(instant_ntp->GetController().CopyStateFromAndPrune(
|
| + &source_contents->GetController()));
|
| ReplaceWebContentsAt(
|
| browser_->tab_strip_model()->GetIndexOfWebContents(source_contents),
|
| instant_ntp.Pass());
|
| } else {
|
| - instant_ntp->GetController().PruneAllButActive();
|
| + CHECK(instant_ntp->GetController().PruneAllButVisible());
|
| // If |source_contents| is NULL, then the caller is responsible for
|
| // inserting instant_ntp into the tabstrip and will take ownership.
|
| ignore_result(instant_ntp.release());
|
|
|