Source/WebKit2/ChangeLog

 12012-02-27 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
 2
 3 [Qt] Allow read/write to the WebView.url property
 4 https://bugs.webkit.org/show_bug.cgi?id=77554
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Change QML API WebView.url to read/write to reflect either the url requested by the user.
 9 Also removed WebView.load(url). Defers setting url (loading page) until onComponentComplete is triggered.
 10 Fixed c++ and qml tests to reflect the new API.
 11
 12 * Target.pri:
 13 * UIProcess/API/qt/qquickwebview.cpp:
 14 (QQuickWebViewPrivate::QQuickWebViewPrivate):
 15 (QQuickWebViewPrivate::onComponentComplete):
 16 (QQuickWebView::setUrl):
 17 * UIProcess/API/qt/qquickwebview_p_p.h:
 18 (QQuickWebViewPrivate):
 19 * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
 20 * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml:
 21 * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml:
 22 * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml:
 23 * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml:
 24 * UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml:
 25 * UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml:
 26 * UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml:
 27 * UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml:
 28 * UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml:
 29 * UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml:
 30 * UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml:
 31 * UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml:
 32 * UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml:
 33 * UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml:
 34 * UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml:
 35 * UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml:
 36 * UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml:
 37 * UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml:
 38 * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
 39 (tst_QQuickWebView::loadEmptyPageViewHidden):
 40 (tst_QQuickWebView::loadNonexistentFileUrl):
 41
1422012-02-27 Enrica Casucci <enrica@apple.com>
243
344 WebKit2: implement platform strategy to access Pasteboard in the UI process.

Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

@@void QQuickWebViewPrivate::loadDidSucceed()
153153 emit q->loadingChanged(&loadRequest);
154154}
155155
 156void QQuickWebViewPrivate::onComponentComplete()
 157{
 158 if (m_defferedUrlToLoad.isEmpty())
 159 return;
 160
 161 q_ptr->setUrl(m_defferedUrlToLoad);
 162}
 163
156164void QQuickWebViewPrivate::setNeedsDisplay()
157165{
158166 Q_Q(QQuickWebView);

@@QQuickWebPage* QQuickWebView::page()
11181126 return d->pageView.data();
11191127}
11201128
1121 void QQuickWebView::load(const QUrl& url)
1122 {
1123  if (url.isEmpty())
1124  return;
1125 
1126  Q_D(QQuickWebView);
1127  d->webPageProxy->loadURL(url.toString());
1128 }
1129 
11301129void QQuickWebView::goBack()
11311130{
11321131 Q_D(QQuickWebView);

@@QUrl QQuickWebView::url() const
11611160 return QUrl(QString(mainFrame->url()));
11621161}
11631162
 1163void QQuickWebView::setUrl(const QUrl& url)
 1164{
 1165 Q_D(QQuickWebView);
 1166
 1167 if (url.isEmpty())
 1168 return;
 1169
 1170 if (!isComponentComplete()) {
 1171 d->m_defferedUrlToLoad = url;
 1172 return;
 1173 }
 1174
 1175 d->webPageProxy->loadURL(url.toString());
 1176}
 1177
11641178QUrl QQuickWebView::icon() const
11651179{
11661180 Q_D(const QQuickWebView);

Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h

@@QT_END_NAMESPACE
6868class QWEBKIT_EXPORT QQuickWebView : public QQuickItem {
6969 Q_OBJECT
7070 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
71  Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
 71 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
7272 Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged FINAL)
7373 Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged FINAL)
7474 Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)

@@public:
110110 virtual ~QQuickWebView();
111111
112112 QUrl url() const;
 113 void setUrl(const QUrl&);
113114 QUrl icon() const;
114115 QString title() const;
115116 int loadProgress() const;

@@public:
137138 QPointF pageItemPos();
138139
139140public Q_SLOTS:
140  void load(const QUrl&);
141141 void loadHtml(const QString& html, const QUrl& baseUrl = QUrl());
142142
143143 void goBack();

Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

@@public:
7373 virtual void updateContentsSize(const QSizeF&) { }
7474
7575 virtual void loadDidSucceed();
76  virtual void onComponentComplete() { }
 76 virtual void onComponentComplete();
7777 virtual void loadDidCommit() { }
7878 virtual void didFinishFirstNonEmptyLayout() { }
7979 virtual void didChangeViewportProperties(const WebCore::ViewportArguments& args) { }

@@protected:
161161 bool m_renderToOffscreenBuffer;
162162 bool m_loadStartedSignalSent;
163163 QUrl m_iconURL;
 164 QUrl m_defferedUrlToLoad;
164165};
165166
166167class QQuickWebViewLegacyPrivate : public QQuickWebViewPrivate {

Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp

@@static QStringList expectedAPI = QStringList()
7070 << "QQuickWebView.linkHovered(QUrl,QString) --> void"
7171 << "QQuickWebView.navigationStateChanged() --> void"
7272 << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void"
73  << "QQuickWebView.load(QUrl) --> void"
7473 << "QQuickWebView.loadHtml(QString,QUrl) --> void"
7574 << "QQuickWebView.loadHtml(QString) --> void"
7675 << "QQuickWebView.goBack() --> void"

Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml

@@TestWebView {
5353 webView.finalSelection = -1
5454 webView.useAcceptDirectly = false
5555 webView.selectorLoaded = false
56  webView.load(Qt.resolvedUrl("../common/select.html"))
 56 webView.url = Qt.resolvedUrl("../common/select.html")
5757 verify(webView.waitForLoadSucceeded())
5858 titleSpy.clear()
5959 }

Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml

@@TestWebView {
4343
4444 function test_linkHovered() {
4545 compare(spy.count, 0)
46  webView.load(Qt.resolvedUrl("../common/test2.html"))
 46 webView.url = Qt.resolvedUrl("../common/test2.html")
4747 verify(webView.waitForLoadSucceeded())
4848 mouseMove(webView, 100, 100)
4949 spy.wait()

@@TestWebView {
5959
6060 function test_linkHoveredDoesntEmitRepeated() {
6161 compare(spy.count, 0)
62  webView.load(Qt.resolvedUrl("../common/test2.html"))
 62 webView.url = Qt.resolvedUrl("../common/test2.html")
6363 verify(webView.waitForLoadSucceeded())
6464
6565 for (var i = 0; i < 100; i += 10)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml

@@Item {
5656 }
5757
5858 function test_basic() {
59  webView.load(testUrl)
 59 webView.url = testUrl
6060 verify(webView.waitForLoadSucceeded())
6161 webView.experimental.postMessage("HELLO")
6262 messageSpy.wait()

@@Item {
6565 }
6666
6767 function test_twoWebViews() {
68  webView.load(testUrl)
69  otherWebView.load(testUrl)
 68 webView.url = testUrl
 69 otherWebView.url = testUrl
7070 verify(webView.waitForLoadSucceeded())
7171 verify(otherWebView.waitForLoadSucceeded())
7272 webView.experimental.postMessage("FIRST")

@@Item {
7878 }
7979
8080 function test_disabled() {
81  disabledWebView.load(testUrl)
 81 disabledWebView.url = testUrl
8282 verify(!disabledWebView.experimental.preferences.navigatorQtObjectEnabled)
8383 verify(disabledWebView.waitForLoadSucceeded())
8484 disabledWebView.experimental.postMessage("HI")

Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml

@@Item {
2323 if (shouldDownload)
2424 request.action = WebViewExperimental.DownloadRequest
2525 else if (request.button == Qt.MiddleButton && request.modifiers & Qt.ControlModifier) {
26  otherWebView.load(request.url)
 26 otherWebView.url = request.url
2727 request.action = WebView.IgnoreRequest
2828 }
2929 originatingUrl = request.originatingUrl

@@Item {
8282 }
8383
8484 function test_usePolicy() {
85  webView.load(beginUrl)
 85 webView.url = beginUrl
8686 verify(webView.waitForLoadSucceeded())
8787 mouseClick(webView, 100, 100, Qt.LeftButton)
8888 verify(webView.waitForLoadSucceeded())

@@Item {
9191 }
9292
9393 function test_ignorePolicy() {
94  webView.load(beginUrl)
 94 webView.url = beginUrl
9595 verify(webView.waitForLoadSucceeded())
9696 mouseClick(webView, 100, 100, Qt.MiddleButton, Qt.ControlModifier)
9797 verify(otherWebView.waitForLoadSucceeded())

@@Item {
102102 }
103103
104104 function test_downloadPolicy() {
105  webView.load(beginUrl)
 105 webView.url = beginUrl
106106 verify(webView.waitForLoadSucceeded())
107107 downloadSpy.clear()
108108 downloadFinishedSpy.clear()

@@Item {
117117 }
118118
119119 function test_originatingUrl() {
120  webView.load(beginUrl)
 120 webView.url = beginUrl
121121 verify(webView.waitForLoadSucceeded())
122122 mouseClick(webView, 100, 100, Qt.LeftButton)
123123 verify(webView.waitForLoadSucceeded())

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml

@@WebView {
7878 spyTitle.clear()
7979 compare(spyTitle.count, 0)
8080 var testUrl = "applicationScheme://something"
81  webView.load(testUrl)
 81 webView.url = testUrl
8282 spyTitle.wait()
8383 compare(webView.title, "Test Application Scheme")
8484 }

@@WebView {
8888 spyTitle.clear()
8989 compare(spyTitle.count, 0)
9090 var testUrl = "scheme2://some-url-string"
91  webView.load(testUrl)
 91 webView.url = testUrl
9292 spyTitle.wait()
9393 compare(webView.title, "Scheme2 Reply")
9494
9595 testUrl = "scheme1://some-url-string"
96  webView.load(testUrl)
 96 webView.url = testUrl
9797 spyTitle.wait()
9898 compare(webView.title, "Scheme1 Reply")
9999

@@WebView {
104104 spyTitle.clear()
105105 compare(spyTitle.count, 0)
106106 var testUrl = "scheme3://url1"
107  webView.load(testUrl)
 107 webView.url = testUrl
108108 spyTitle.wait()
109109 compare(webView.title, "Scheme3 Reply1")
110110
111111 testUrl = "scheme3://url2"
112  webView.load(testUrl)
 112 webView.url = testUrl
113113 spyTitle.wait()
114114 compare(webView.title, "Scheme3 Reply2")
115115

@@WebView {
120120 spyTitle.clear()
121121 compare(spyTitle.count, 0)
122122 var testUrl = "schemeCharset://latin1"
123  webView.load(testUrl)
 123 webView.url = testUrl
124124 spyTitle.wait()
125125 compare(webView.title, "title with copyright ©")
126126
127127 testUrl = "schemeCharset://utf-8"
128  webView.load(testUrl)
 128 webView.url = testUrl
129129 spyTitle.wait()
130130 compare(webView.title, "title with copyright ©")
131131 }

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml

@@WebView {
6161
6262 function test_downloadRequest() {
6363 compare(spy.count, 0)
64  webView.load(Qt.resolvedUrl("../common/download.zip"))
 64 webView.url = Qt.resolvedUrl("../common/download.zip")
6565 spy.wait()
6666 compare(spy.count, 1)
6767 }
6868
6969 function test_expectedLength() {
7070 compare(spy.count, 0)
71  webView.load(Qt.resolvedUrl("../common/download.zip"))
 71 webView.url = Qt.resolvedUrl("../common/download.zip")
7272 spy.wait()
7373 compare(spy.count, 1)
7474 compare(expectedLength, 325)

@@WebView {
7676
7777 function test_succeeded() {
7878 compare(spy.count, 0)
79  webView.load(Qt.resolvedUrl("../common/download.zip"))
 79 webView.url = Qt.resolvedUrl("../common/download.zip")
8080 spy.wait()
8181 compare(spy.count, 1)
8282 downloadFinishedSpy.wait()

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml

@@TestWebView {
2424 function init() {
2525 if (webView.icon != '') {
2626 // If this is not the first test, then load a blank page without favicon, restoring the initial state.
27  webView.load('about:blank')
 27 webView.url = 'about:blank'
2828 spy.wait()
2929 verify(webView.waitForLoadSucceeded())
3030 }

@@TestWebView {
3434 function test_favIconLoad() {
3535 compare(spy.count, 0)
3636 var url = Qt.resolvedUrl("../common/favicon.html")
37  webView.load(url)
 37 webView.url = url
3838 spy.wait()
3939 compare(spy.count, 1)
4040 compare(favicon.width, 48)

@@TestWebView {
4444 function test_favIconLoadEncodedUrl() {
4545 compare(spy.count, 0)
4646 var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!")
47  webView.load(url)
 47 webView.url = url
4848 spy.wait()
4949 compare(spy.count, 1)
5050 compare(favicon.width, 16)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml

@@WebView {
4646
4747 function test_permissionRequest() {
4848 compare(spy.count, 0)
49  webView.load(Qt.resolvedUrl("../common/geolocation.html"))
 49 webView.url = Qt.resolvedUrl("../common/geolocation.html")
5050 spy.wait()
5151 compare(spy.count, 1)
5252 }

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml

@@TestWebView {
6767 }
6868
6969 function test_alert() {
70  webView.load(Qt.resolvedUrl("../common/alert.html"))
 70 webView.url = Qt.resolvedUrl("../common/alert.html")
7171 verify(webView.waitForLoadSucceeded())
7272 compare(webView.messageFromAlertDialog, "Hello Qt")
7373 verify(webView.modelMessageEqualsMessage)

@@TestWebView {
7575
7676 function test_alertWithoutDialog() {
7777 webView.experimental.alertDialog = null
78  webView.load(Qt.resolvedUrl("../common/alert.html"))
 78 webView.url = Qt.resolvedUrl("../common/alert.html")
7979 verify(webView.waitForLoadSucceeded())
8080 compare(webView.messageFromAlertDialog, "")
8181 }
8282
8383 function test_confirm() {
84  webView.load(Qt.resolvedUrl("../common/confirm.html"))
 84 webView.url = Qt.resolvedUrl("../common/confirm.html")
8585 verify(webView.waitForLoadSucceeded())
8686 compare(webView.confirmCount, 2)
8787 compare(webView.title, "ACCEPTED REJECTED")

@@TestWebView {
8989
9090 function test_confirmWithoutDialog() {
9191 webView.experimental.confirmDialog = null
92  webView.load(Qt.resolvedUrl("../common/confirm.html"))
 92 webView.url = Qt.resolvedUrl("../common/confirm.html")
9393 verify(webView.waitForLoadSucceeded())
9494 compare(webView.confirmCount, 0)
9595 compare(webView.title, "ACCEPTED ACCEPTED")
9696 }
9797
9898 function test_prompt() {
99  webView.load(Qt.resolvedUrl("../common/prompt.html"))
 99 webView.url = Qt.resolvedUrl("../common/prompt.html")
100100 verify(webView.waitForLoadSucceeded())
101101 compare(webView.promptCount, 2)
102102 compare(webView.title, "tQ olleH")

@@TestWebView {
104104
105105 function test_promptWithoutDialog() {
106106 webView.experimental.promptDialog = null
107  webView.load(Qt.resolvedUrl("../common/prompt.html"))
 107 webView.url = Qt.resolvedUrl("../common/prompt.html")
108108 verify(webView.waitForLoadSucceeded())
109109 compare(webView.promptCount, 0)
110110 compare(webView.title, "FAIL")

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml

@@TestWebView {
1515 name: "WebViewLoadFail"
1616 function test_fail() {
1717 testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
18  webView.load(testUrl)
 18 webView.url = testUrl
1919 verify(webView.waitForLoadFailed())
2020 }
2121 }

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml

@@TestWebView {
1313
1414 function test_loadProgress() {
1515 compare(webView.loadProgress, 0)
16  webView.load(Qt.resolvedUrl("../common/test1.html"))
 16 webView.url = Qt.resolvedUrl("../common/test1.html")
1717 compare(webView.loadProgress, 0)
1818 verify(webView.waitForLoadSucceeded())
1919 compare(webView.loadProgress, 100)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml

@@TestWebView {
2020 function test_loadProgressSignal() {
2121 compare(spyProgress.count, 0)
2222 compare(webView.loadProgress, 0)
23  webView.load(Qt.resolvedUrl("../common/test1.html"))
 23 webView.url = Qt.resolvedUrl("../common/test1.html")
2424 spyProgress.wait()
2525 compare(true, webView.loadProgress > -1 && webView.loadProgress < 101)
2626 if (webView.loadProgress > 0 && webView.loadProgress < 100) {

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml

@@TestWebView {
3030 function test_loadIgnoreEmptyUrl() {
3131 var url = Qt.resolvedUrl("../common/test1.html")
3232
33  webView.load(url)
 33 webView.url = url
3434 verify(webView.waitForLoadSucceeded())
3535 compare(numLoadStarted, 1)
3636 compare(numLoadSucceeded, 1)
3737 compare(webView.url, url)
3838
3939 lastUrl = webView.url
40  webView.load('')
 40 webView.url = ''
4141 wait(1000)
4242 compare(numLoadStarted, 1)
4343 compare(numLoadSucceeded, 1)
4444 compare(webView.url, lastUrl)
4545
46  webView.load('about:blank')
 46 webView.url = 'about:blank'
4747 verify(webView.waitForLoadSucceeded())
4848 compare(numLoadStarted, 2)
4949 compare(numLoadSucceeded, 2)

@@TestWebView {
5151
5252 // It shouldn't interrupt any ongoing load when an empty url is used.
5353 watchProgress = true
54  webView.load(url)
 54 webView.url = url
5555 webView.waitForLoadSucceeded()
5656 compare(numLoadStarted, 3)
5757 compare(numLoadSucceeded, 3)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml

@@TestWebView {
3636
3737 function test_navigationHistory() {
3838 compare(webView.loadProgress, 0)
39  webView.load(Qt.resolvedUrl("../common/test1.html"))
 39 webView.url = Qt.resolvedUrl("../common/test1.html")
4040 verify(webView.waitForLoadSucceeded())
4141 compare(webView.canGoBack, false)
4242 compare(webView.canGoForward, false)
4343 compare(backItemsList.count, 0)
4444 compare(forwardItemsList.count, 0)
45  webView.load(Qt.resolvedUrl("../common/test2.html"))
 45 webView.url = Qt.resolvedUrl("../common/test2.html")
4646 verify(webView.waitForLoadSucceeded())
4747 compare(webView.url, Qt.resolvedUrl("../common/test2.html"))
4848 compare(webView.canGoBack, true)

@@TestWebView {
6262 compare(webView.canGoForward, false)
6363 compare(backItemsList.count, 1)
6464 compare(forwardItemsList.count, 0)
65  webView.load(Qt.resolvedUrl("../common/javascript.html"))
 65 webView.url = Qt.resolvedUrl("../common/javascript.html")
6666 verify(webView.waitForLoadSucceeded())
6767 compare(webView.url, Qt.resolvedUrl("../common/javascript.html"))
6868 compare(webView.canGoBack, true)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml

@@WebView {
4848
4949 function test_permissionRequest() {
5050 compare(spy.count, 0)
51  webView.load(Qt.resolvedUrl("../common/geolocation.html"))
 51 webView.url = Qt.resolvedUrl("../common/geolocation.html")
5252 spy.wait()
5353 compare(spy.count, 1)
5454 compare(webView.success, true)

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml

@@Item {
121121 webView.experimental.preferences.defaultFixedFontSize = defaultFixedFontSize
122122
123123 if (webView.url != '' && webView.url != 'about:blank') {
124  webView.load('about:blank')
 124 webView.url = 'about:blank'
125125 verify(webView.waitForLoadSucceeded())
126126 }
127127

@@Item {
145145 function test_javascriptEnabled() {
146146 webView.experimental.preferences.javascriptEnabled = true
147147 var testUrl = Qt.resolvedUrl("../common/javascript.html")
148  webView.load(testUrl)
 148 webView.url = testUrl
149149 verify(webView.waitForLoadSucceeded())
150150 compare(webView.title, "New Title")
151151 }

@@Item {
153153 function test_javascriptDisabled() {
154154 webView.experimental.preferences.javascriptEnabled = false
155155 var testUrl = Qt.resolvedUrl("../common/javascript.html")
156  webView.load(testUrl)
 156 webView.url = testUrl
157157 verify(webView.waitForLoadSucceeded())
158158 compare(webView.title, "Original Title")
159159 }

@@Item {
161161 function test_localStorageDisabled() {
162162 webView.experimental.preferences.localStorageEnabled = false
163163 var testUrl = Qt.resolvedUrl("../common/localStorage.html")
164  webView.load(testUrl)
 164 webView.url = testUrl
165165 verify(webView.waitForLoadSucceeded())
166166 compare(webView.title, "Original Title")
167167 }

@@Item {
169169 function test_localStorageEnabled() {
170170 webView.experimental.preferences.localStorageEnabled = true
171171 var testUrl = Qt.resolvedUrl("../common/localStorage.html")
172  webView.load(testUrl)
 172 webView.url = testUrl
173173 verify(webView.waitForLoadSucceeded())
174  webView.load(testUrl)
 174 webView.url = testUrl
175175 verify(webView.waitForLoadSucceeded())
176176 compare(webView.title, "New Title")
177177 }

@@Item {
180180 webView.experimental.preferences.javascriptEnabled = true
181181 webView2.experimental.preferences.javascriptEnabled = true
182182 var testUrl = Qt.resolvedUrl("../common/javascript.html")
183  webView.load(testUrl)
 183 webView.url = testUrl
184184 verify(webView.waitForLoadSucceeded())
185  webView2.load(testUrl)
 185 webView2.url = testUrl
186186 verify(webView2.waitForLoadSucceeded())
187187 compare(webView.title, "New Title")
188188 compare(webView2.title, "New Title")
189189 webView.experimental.preferences.javascriptEnabled = false
190  webView.load(testUrl)
 190 webView.url = testUrl
191191 verify(webView.waitForLoadSucceeded())
192  webView2.load(testUrl)
 192 webView2.url = testUrl
193193 verify(webView2.waitForLoadSucceeded())
194194 compare(webView.title, "Original Title")
195195 compare(webView2.title, "New Title")

@@Item {
197197
198198 function test_standardFontFamilyChanged() {
199199 var url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-family")
200  webView.load(url)
 200 webView.url = url
201201 titleSpy.wait()
202202 compare(webView.title, "Original Title")
203203 titleSpy.wait()

@@Item {
206206 webView.experimental.preferences.standardFontFamily = "foobar"
207207 standardFontFamilySpy.wait()
208208 compare(standardFontFamilySpy.count, 1)
209  webView.load(url)
 209 webView.url = url
210210 titleSpy.wait()
211211 compare(webView.title, "Original Title")
212212 titleSpy.wait()

@@Item {
215215
216216 function test_fontSizeChanged() {
217217 var url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-size")
218  webView.load(url)
 218 webView.url = url
219219 titleSpy.wait()
220220 compare(webView.title, "Original Title")
221221 titleSpy.wait()

@@Item {
224224 webView.experimental.preferences.defaultFontSize = defaultFontSize + 1
225225 defaultFontSizeSpy.wait()
226226 compare(defaultFontSizeSpy.count, 1)
227  webView.load(url)
 227 webView.url = url
228228 titleSpy.wait()
229229 compare(webView.title, "Original Title")
230230 titleSpy.wait()

@@Item {
233233
234234 function test_fixedFontSizeChanged() {
235235 var url = Qt.resolvedUrl("../common/font-preferences.html?fixed#font-size")
236  webView.load(url)
 236 webView.url = url
237237 titleSpy.wait()
238238 compare(webView.title, "Original Title")
239239 titleSpy.wait()

@@Item {
242242 webView.experimental.preferences.defaultFixedFontSize = defaultFixedFontSize + 1
243243 defaultFixedFontSizeSpy.wait()
244244 compare(defaultFixedFontSizeSpy.count, 1)
245  webView.load(url)
 245 webView.url = url
246246 titleSpy.wait()
247247 compare(webView.title, "Original Title")
248248 titleSpy.wait()
249249 compare(webView.title, (defaultFixedFontSize + 1).toString() + "px")
250250
251  webView.load(Qt.resolvedUrl("../common/font-preferences.html?standard#font-size"))
 251 webView.url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-size")
252252 titleSpy.wait()
253253 compare(webView.title, "Original Title")
254254 titleSpy.wait()

@@Item {
258258 function test_minimumFontSizeChanged() {
259259 verify(defaultMinimumFontSize < defaultFontSize)
260260 var url = Qt.resolvedUrl("../common/font-preferences.html?minimum#font-size")
261  webView.load(url)
 261 webView.url = url
262262 titleSpy.wait()
263263 compare(webView.title, "Original Title")
264264 titleSpy.wait()

@@Item {
270270 webView.experimental.preferences.minimumFontSize = defaultFontSize
271271 minimumFontSizeSpy.wait()
272272 compare(minimumFontSizeSpy.count, 1)
273  webView.load(url)
 273 webView.url = url
274274 titleSpy.wait()
275275 compare(webView.title, "Original Title")
276276 titleSpy.wait()

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml

@@TestWebView {
1212 name: "WebViewProperties"
1313
1414 function test_title() {
15  webView.load(Qt.resolvedUrl("../common/test1.html"))
 15 webView.url = Qt.resolvedUrl("../common/test1.html")
1616 verify(webView.waitForLoadSucceeded())
1717 compare(webView.title, "Test page 1")
1818 }
1919
2020 function test_url() {
2121 var testUrl = Qt.resolvedUrl("../common/test1.html")
22  webView.load(testUrl)
 22 webView.url = testUrl
2323 verify(webView.waitForLoadSucceeded())
2424 compare(webView.url, testUrl)
2525 }

Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml

@@TestWebView {
2020 function test_titleFirstLoad() {
2121 compare(spyTitle.count, 0)
2222 var testUrl = Qt.resolvedUrl("../common/test3.html")
23  webView.load(testUrl)
 23 webView.url = testUrl
2424 verify(webView.waitForLoadSucceeded())
2525 spyTitle.wait()
2626 compare(webView.title, "Test page 3")

Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp

@@void tst_QQuickWebView::stopEnabledAfterLoadStarted()
154154 QCOMPARE(webView()->loading(), false);
155155
156156 LoadStartedCatcher catcher(webView());
157  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 157 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
158158 waitForSignal(&catcher, SIGNAL(finished()));
159159
160160 QCOMPARE(webView()->loading(), true);

@@void tst_QQuickWebView::baseUrl()
170170
171171void tst_QQuickWebView::loadEmptyUrl()
172172{
173  webView()->load(QUrl());
174  webView()->load(QUrl(QLatin1String("")));
 173 webView()->setUrl(QUrl());
 174 webView()->setUrl(QUrl(QLatin1String("")));
175175}
176176
177177void tst_QQuickWebView::loadEmptyPageViewVisible()

@@void tst_QQuickWebView::loadEmptyPageViewHidden()
184184{
185185 QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebLoadRequest*)));
186186
187  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 187 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
188188 QVERIFY(waitForLoadSucceeded(webView()));
189189
190190 QCOMPARE(loadSpy.size(), 2);

@@void tst_QQuickWebView::loadNonexistentFileUrl()
194194{
195195 QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebLoadRequest*)));
196196
197  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html")));
 197 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html")));
198198 QVERIFY(waitForLoadFailed(webView()));
199199
200200 QCOMPARE(loadSpy.size(), 2);

@@void tst_QQuickWebView::loadNonexistentFileUrl()
202202
203203void tst_QQuickWebView::backAndForward()
204204{
205  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 205 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
206206 QVERIFY(waitForLoadSucceeded(webView()));
207207
208208 QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
209209
210  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html")));
 210 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html")));
211211 QVERIFY(waitForLoadSucceeded(webView()));
212212
213213 QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html"));

@@void tst_QQuickWebView::backAndForward()
225225
226226void tst_QQuickWebView::reload()
227227{
228  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 228 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
229229 QVERIFY(waitForLoadSucceeded(webView()));
230230
231231 QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));

@@void tst_QQuickWebView::reload()
238238
239239void tst_QQuickWebView::stop()
240240{
241  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 241 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
242242 QVERIFY(waitForLoadSucceeded(webView()));
243243
244244 QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));

@@void tst_QQuickWebView::loadProgress()
251251{
252252 QCOMPARE(webView()->loadProgress(), 0);
253253
254  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 254 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
255255 QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged(int)));
256256 QVERIFY(waitForLoadSucceeded(webView()));
257257

@@void tst_QQuickWebView::showWebView()
272272{
273273 webView()->setSize(QSizeF(300, 400));
274274
275  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/direct-image-compositing.html")));
 275 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/direct-image-compositing.html")));
276276 QVERIFY(waitForLoadSucceeded(webView()));
277277
278278 m_window->show();

@@void tst_QQuickWebView::multipleWebViewWindows()
308308 QScopedPointer<TestWindow> window2(new TestWindow(webView2));
309309
310310 webView1->setSize(QSizeF(300, 400));
311  webView1->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
 311 webView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
312312 QVERIFY(waitForLoadSucceeded(webView1));
313313 window1->show();
314314 webView1->setVisible(true);
315315
316316 webView2->setSize(QSizeF(300, 400));
317  webView2->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 317 webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
318318 QVERIFY(waitForLoadSucceeded(webView2));
319319 window2->show();
320320 webView2->setVisible(true);

@@void tst_QQuickWebView::multipleWebViews()
332332 webView2->setParentItem(m_window->rootItem());
333333
334334 webView1->setSize(QSizeF(300, 400));
335  webView1->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
 335 webView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
336336 QVERIFY(waitForLoadSucceeded(webView1.data()));
337337 webView1->setVisible(true);
338338
339339 webView2->setSize(QSizeF(300, 400));
340  webView2->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
 340 webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
341341 QVERIFY(waitForLoadSucceeded(webView2.data()));
342342 webView2->setVisible(true);
343343 QTest::qWait(200);

@@void tst_QQuickWebView::scrollRequest()
347347{
348348 webView()->setSize(QSizeF(300, 400));
349349
350  webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
 350 webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
351351 QVERIFY(waitForLoadSucceeded(webView()));
352352
353353 // COMPARE with the position requested in the html

Tools/ChangeLog

 12012-02-27 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
 2
 3 [Qt] Allow read/write to the WebView.url property
 4 https://bugs.webkit.org/show_bug.cgi?id=77554
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Fix MiniBrowser to use WebView.url property and remove WebView.load usage.
 9
 10 * MiniBrowser/qt/qml/BrowserWindow.qml:
 11
1122012-02-27 Greg Billock <gbillock@google.com>
213
314 Add more tests for web intents

Tools/MiniBrowser/qt/qml/BrowserWindow.qml

@@Rectangle {
3939 signal newWindow(string url)
4040
4141 function load(address) {
42  webView.load(address)
 42 webView.url = address
4343 }
4444
4545 function reload() {

@@Rectangle {
283283
284284 Keys.onReturnPressed:{
285285 console.log("going to: ", addressLine.text)
286  webView.load(utils.urlFromUserInput(addressLine.text))
 286 webView.url = utils.urlFromUserInput(addressLine.text)
287287 }
288288 }
289289 }