summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 16:15:01 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 16:15:01 +0000
commit78a3a6f8ea98f45a4b8f41f1dfc067f913815f43 (patch)
treef3f97bb15f24be4bbff09c2f73fefc6cd5dc2fe2 /webkit
parent574d5c165f055e21a93ac97e8f5f66a2aea5b65a (diff)
downloadchromium_src-78a3a6f8ea98f45a4b8f41f1dfc067f913815f43.zip
chromium_src-78a3a6f8ea98f45a4b8f41f1dfc067f913815f43.tar.gz
chromium_src-78a3a6f8ea98f45a4b8f41f1dfc067f913815f43.tar.bz2
Set the WebViewDelegate earlier during WebView creation to ensure that
DidCreateDataSource gets called when constructing the initial data source for the WebView's main frame. This ensures that the NavigationState associated with a WebDataSource can never be null. I went ahead and removed some of the null-checks that were added to avoid other related crashes. (To fix bug 15594, I really really didn't want to add another one of those null checks.) BUG=15594 TEST=partially covered by existing ui tests R=dglazkov Review URL: http://codereview.chromium.org/150208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webview_impl.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index e40d27b..1220f7a 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -313,15 +313,14 @@ WebView* WebView::Create(WebViewDelegate* delegate,
instance->AddRef();
instance->SetPreferences(prefs);
- // Here, we construct a new WebFrameImpl with a reference count of 0. That
- // is bumped up to 1 by InitMainFrame. The reference count is decremented
- // when the corresponding WebCore::Frame object is destroyed.
- WebFrameImpl* main_frame = new WebFrameImpl();
- main_frame->InitMainFrame(instance);
+ // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame
+ // and releases that reference once the corresponding Frame is destroyed.
+ scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl();
- // Set the delegate after initializing the main frame, to avoid trying to
- // respond to notifications before we're fully initialized.
+ // Set the delegate before initializing the frame, so that notifications like
+ // DidCreateDataSource make their way to the client.
instance->delegate_ = delegate;
+ main_frame->InitMainFrame(instance);
WebDevToolsAgentDelegate* tools_delegate =
delegate->GetWebDevToolsAgentDelegate();