Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2159)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 12602003: When a pending contents is created but deleted before it is shown, remove it from the list of pendi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_) {

Powered by Google App Engine
This is Rietveld 408576698