Changeset 39863 in webkit
- Timestamp:
- Jan 13, 2009 9:58:57 AM (15 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r39753 r39863 101 101 { 102 102 QWebPagePrivate::drtRun = b; 103 } 104 105 void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName) 106 { 107 page->handle()->page->setGroupName(groupName); 108 } 109 110 QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) 111 { 112 return page->handle()->page->groupName(); 103 113 } 104 114 … … 2652 2662 */ 2653 2663 2664 /*! 2665 \fn QWebPagePrivate* QWebPage::handle() const 2666 \internal 2667 */ 2654 2668 2655 2669 #include "moc_qwebpage.cpp" -
trunk/WebKit/qt/Api/qwebpage.h
r39581 r39863 270 270 virtual bool supportsExtension(Extension extension) const; 271 271 272 inline QWebPagePrivate* handle() const { return d; } 273 272 274 Q_SIGNALS: 273 275 void loadStarted(); -
trunk/WebKit/qt/Api/qwebsettings.cpp
r39706 r39863 730 730 } 731 731 732 /* !732 /* 733 733 \since 4.5 734 734 … … 741 741 \sa localStorageDatabasePath() 742 742 */ 743 void QWebSettings::setLocalStorageDatabasePath(const QString& path) 744 { 745 QWebSettingsPrivate *global = QWebSettings::globalSettings()->d; 746 global->localStorageDatabasePath = path; 743 744 void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path) 745 { 746 QWebSettingsPrivate *d = settings->handle(); 747 d->localStorageDatabasePath = path; 747 748 d->apply(); 748 749 } 749 750 750 /* !751 /* 751 752 \since 4.5 752 753 … … 756 757 \sa setLocalStorageDatabasePath() 757 758 */ 758 QString QWebSettings::localStorageDatabasePath() const 759 { 760 QWebSettingsPrivate *global = QWebSettings::globalSettings()->d; 761 return global->localStorageDatabasePath; 762 } 759 QString QWEBKIT_EXPORT qt_websettings_localStorageDatabasePath(QWebSettings* settings) 760 { 761 return settings->handle()->localStorageDatabasePath; 762 } 763 764 /*! 765 \fn QWebSettingsPrivate* QWebSettings::handle() const 766 \internal 767 */ -
trunk/WebKit/qt/Api/qwebsettings.h
r39173 r39863 116 116 static QString offlineWebApplicationCachePath(); 117 117 118 void setLocalStorageDatabasePath(const QString& path); 119 QString localStorageDatabasePath() const; 118 inline QWebSettingsPrivate* handle() const { return d; } 120 119 121 120 private: -
trunk/WebKit/qt/ChangeLog
r39826 r39863 1 2009-01-13 Simon Hausmann <simon.hausmann@nokia.com> 2 3 Reviewed by Tor Arne Vestbø. 4 5 https://bugs.webkit.org/show_bug.cgi?id=23171 6 7 Based on patch by Yael Aharon <yael.aharon@nokia.com> 8 9 Make the QWebSettings functions for setting the path for the local 10 storage database private QtWebkit API, including the ability to 11 associated a QWebPage with a named page group. 12 13 * Api/qwebpage.cpp: 14 (qt_webpage_setGroupName): Added. 15 (qt_webpage_groupName): Added. 16 * Api/qwebpage.h: 17 (ExtensionOption::handle): Added internal helper function. 18 * Api/qwebsettings.cpp: 19 (qt_websettings_setLocalStorageDatabasePath): Made private API. 20 (qt_websettings_localStorageDatabasePath): Made private API. 21 * Api/qwebsettings.h: 22 * tests/qwebpage/tst_qwebpage.cpp: 23 (tst_QWebPage::database): Small cleanup. 24 (tst_QWebPage::multiplePageGroupsAndLocalStorage): New test for the 25 page group handling, written by Yael. 26 1 27 2009-01-12 Tor Arne Vestbø <tavestbo@trolltech.com> 2 28 -
trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r39678 r39863 101 101 void destroyPlugin(); 102 102 void createViewlessPlugin(); 103 void multiplePageGroupsAndLocalStorage(); 103 104 104 105 private: … … 370 371 QWebSettings::setOfflineStorageDefaultQuota(1024 * 1024); 371 372 QVERIFY(QWebSettings::offlineStorageDefaultQuota() == 1024 * 1024); 372 373 m_page->settings()->setOfflineWebApplicationCachePath(path);374 QVERIFY(m_page->settings()->offlineWebApplicationCachePath() == path);375 376 m_page->settings()->setLocalStorageDatabasePath(path);377 QVERIFY(m_page->settings()->localStorageDatabasePath() == path);378 373 379 374 QString dbFileName = path + "Databases.db"; … … 596 591 } 597 592 593 // import private API 594 void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName); 595 QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page); 596 void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path); 597 598 void tst_QWebPage::multiplePageGroupsAndLocalStorage() 599 { 600 QDir dir(QDir::currentPath()); 601 dir.mkdir("path1"); 602 dir.mkdir("path2"); 603 604 QWebView view1; 605 QWebView view2; 606 607 qt_websettings_setLocalStorageDatabasePath(view1.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path1")); 608 qt_webpage_setGroupName(view1.page(), "group1"); 609 qt_websettings_setLocalStorageDatabasePath(view2.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path2")); 610 qt_webpage_setGroupName(view2.page(), "group2"); 611 QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); 612 QCOMPARE(qt_webpage_groupName(view2.page()), QString("group2")); 613 614 615 view1.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com")); 616 view2.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com")); 617 618 view1.page()->mainFrame()->evaluateJavaScript("localStorage.test='value1';"); 619 view2.page()->mainFrame()->evaluateJavaScript("localStorage.test='value2';"); 620 621 view1.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com")); 622 view2.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com")); 623 624 QVariant s1 = view1.page()->mainFrame()->evaluateJavaScript("localStorage.test"); 625 QCOMPARE(s1.toString(), QString("value1")); 626 627 QVariant s2 = view2.page()->mainFrame()->evaluateJavaScript("localStorage.test"); 628 QCOMPARE(s2.toString(), QString("value2")); 629 630 QTest::qWait(1000); 631 632 QFile::remove(QDir::toNativeSeparators(QDir::currentPath() + "/path1/http_www.myexample.com_0.localstorage")); 633 QFile::remove(QDir::toNativeSeparators(QDir::currentPath() + "/path2/http_www.myexample.com_0.localstorage")); 634 dir.rmdir(QDir::toNativeSeparators("./path1")); 635 dir.rmdir(QDir::toNativeSeparators("./path2")); 636 } 637 598 638 QTEST_MAIN(tst_QWebPage) 599 639 #include "tst_qwebpage.moc"
Note: See TracChangeset
for help on using the changeset viewer.