Skip to content

Instantly share code, notes, and snippets.

@arajkumar
Created August 19, 2013 17:35
Show Gist options
  • Save arajkumar/6271826 to your computer and use it in GitHub Desktop.
Save arajkumar/6271826 to your computer and use it in GitHub Desktop.
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp
index 2af19ed..bd21adb 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp
@@ -90,8 +90,14 @@ QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFr
, marginWidth(0)
, marginHeight(0)
{
- frameLoaderClient = new FrameLoaderClientQt();
- frame = Frame::create(page, ownerElement, frameLoaderClient);
+ // mainframe is already created in WebCore::Page, just use it.
+ if (!parentFrame || !ownerElement) {
+ frame = parentPage->mainFrame();
+ frameLoaderClient = static_cast<FrameLoaderClientQt*>(frame->loader().client());
+ } else {
+ frameLoaderClient = new FrameLoaderClientQt();
+ frame = Frame::create(page, ownerElement, frameLoaderClient);
+ }
// FIXME: All of the below should probably be moved over into WebCore
frame->tree()->setName(name);
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
index cf6a1d8..a10da10 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
@@ -228,6 +228,7 @@ void QWebPageAdapter::initializeWebCorePage()
pageClients.editorClient = new EditorClientQt(this);
pageClients.dragClient = new DragClientQt(pageClients.chromeClient);
pageClients.inspectorClient = new InspectorClientQt(this);
+ pageClients.loaderClientForMainFrame = new FrameLoaderClientQt();
page = new Page(pageClients);
#if ENABLE(GEOLOCATION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment