WebCore/ChangeLog

 12010-09-16 Jacob Dinu <dinu.jacob@nokia.com>
 2
 3 Reviewed by Adam Barth.
 4
 5 When loading a cached page, dispatchDidCommitLoad is called after FrameLoader::open so
 6 that all initialzations are done before calling client dispatchDidCommitLoad to avoid
 7 client from accessing incorrect data.
 8
 9 https://bugs.webkit.org/show_bug.cgi?id=41155
 10
 11 * loader/FrameLoader.cpp:
 12 (WebCore::FrameLoader::commitProvisionalLoad):
 13 (WebCore::FrameLoader::transitionToCommitted):
 14
1152010-09-16 Thomas Zander <t.zander@nokia.com>
216
317 Reviewed by Andreas Kling.
67657

WebCore/loader/FrameLoader.cpp

@@void FrameLoader::commitProvisionalLoad(
18481848 if (cachedPage && cachedPage->document()) {
18491849 prepareForCachedPageRestore();
18501850 cachedPage->restore(m_frame->page());
 1851
 1852 dispatchDidCommitLoad();
 1853
 1854 // If we have a title let the WebView know about it.
 1855 String title = m_documentLoader->title();
 1856 if (!title.isNull())
 1857 m_client->dispatchDidReceiveTitle(title);
 1858
18511859 checkCompleted();
18521860 } else {
18531861 KURL url = pdl->substituteData().responseURL();

@@void FrameLoader::transitionToCommitted(
19281936
19291937 // Handle adding the URL to the back/forward list.
19301938 DocumentLoader* dl = m_documentLoader.get();
1931  String ptitle = dl->title();
19321939
19331940 switch (m_loadType) {
19341941 case FrameLoadTypeForward:

@@void FrameLoader::transitionToCommitted(
20052012
20062013 if (!m_client->hasHTMLView())
20072014 receivedFirstData();
2008  else if (cachedPage) {
2009  // For non-cached HTML pages, these methods are called in receivedFirstData().
2010  dispatchDidCommitLoad();
2011 
2012  // If we have a title let the WebView know about it.
2013  if (!ptitle.isNull())
2014  m_client->dispatchDidReceiveTitle(ptitle);
2015  }
20162015}
20172016
20182017void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress)
67622

WebKit/qt/ChangeLog

 12010-09-16 Jacob Dinu <dinu.jacob@nokia.com>
 2
 3 Reviewed by Adam Barth.
 4
 5 Added a new qwebpage test for loading a cached page
 6 https://bugs.webkit.org/show_bug.cgi?id=41155
 7
 8 * tests/qwebpage/tst_qwebpage.cpp:
 9 (tst_QWebPage::loadCachedPage):
 10
1112010-09-16 Darin Adler <darin@apple.com>
212
313 Fix build.
67657

WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

@@private slots:
9797 void backActionUpdate();
9898 void frameAt();
9999 void requestCache();
 100 void loadCachedPage();
100101 void protectBindingsRuntimeObjectsFromCollector();
101102 void localURLSchemes();
102103 void testOptionalJSObjects();

@@void tst_QWebPage::requestCache()
12881289 (int)QNetworkRequest::PreferCache);
12891290}
12901291
 1292void tst_QWebPage::loadCachedPage()
 1293{
 1294 TestPage page;
 1295 QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
 1296 page.settings()->setMaximumPagesInCache(3);
 1297
 1298 page.mainFrame()->load(QUrl("data:text/html,This is first page"));
 1299
 1300 QTRY_COMPARE(loadSpy.count(), 1);
 1301 QTRY_COMPARE(page.navigations.count(), 1);
 1302
 1303 QUrl firstPageUrl = page.mainFrame()->url();
 1304 page.mainFrame()->load(QUrl("data:text/html,This is second page"));
 1305
 1306 QTRY_COMPARE(loadSpy.count(), 2);
 1307 QTRY_COMPARE(page.navigations.count(), 2);
 1308
 1309 page.triggerAction(QWebPage::Stop);
 1310 QVERIFY(page.history()->canGoBack());
 1311
 1312 QSignalSpy urlSpy(page.mainFrame(), SIGNAL(urlChanged(QUrl)));
 1313 QVERIFY(urlSpy.isValid());
 1314
 1315 page.triggerAction(QWebPage::Back);
 1316 ::waitForSignal(page.mainFrame(), SIGNAL(urlChanged(QUrl)));
 1317 QCOMPARE(urlSpy.size(), 1);
 1318
 1319 QList<QVariant> arguments1 = urlSpy.takeFirst();
 1320 QCOMPARE(arguments1.at(0).toUrl(), firstPageUrl);
 1321
 1322}
12911323void tst_QWebPage::backActionUpdate()
12921324{
12931325 QWebView view;
67622