Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index f7bee53452acc678511175979851aa1a5d09b18d..7efde236d8ee01081812a2244626b6e83298fafa 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -1226,6 +1226,18 @@ void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { |
Source<WebContents>(opener_)); |
opener_ = NULL; |
} |
+ // Clear a pending contents that has been closed before being shown. |
+ for (PendingContents::iterator iter = pending_contents_.begin(); |
+ iter != pending_contents_.end(); |
+ ++iter) { |
+ if (iter->second != web_contents) |
+ continue; |
+ pending_contents_.erase(iter); |
+ registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, |
+ Source<WebContents>(web_contents)); |
+ return; |
+ } |
+ NOTREACHED(); |
Charlie Reis
2013/03/07 18:20:00
Why is this here? It's failing in all the tests,
jochen (gone - plz use gerrit)
2013/03/07 19:45:10
Ah, because I forgot to add a return in the if() b
|
} |
void WebContentsImpl::AddObserver(WebContentsObserver* observer) { |
@@ -1407,6 +1419,8 @@ void WebContentsImpl::CreateNewWindow( |
// later. |
DCHECK_NE(MSG_ROUTING_NONE, route_id); |
pending_contents_[route_id] = new_contents; |
+ registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, |
+ Source<WebContents>(new_contents)); |
} |
if (delegate_) { |