Changeset 115862 in webkit
- Timestamp:
- May 2, 2012 12:19:24 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r115859 r115862 1 2012-05-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 3 Revert r115191 - "Make the web view's url property follow the active url" 4 5 It uncovered/caused issues in the icon-implementation that can't be 6 easily fixed, so rolling out instead. 7 8 https://bugs.webkit.org/show_bug.cgi?id=77554 9 10 Rubber-stamped by Simon Hausmann. 11 12 * UIProcess/API/qt/qquickwebview.cpp: 13 (QQuickWebViewPrivate::onComponentComplete): 14 (QQuickWebView::reload): 15 (QQuickWebView::url): 16 (QQuickWebView::setUrl): 17 (QQuickWebView::loadHtml): 18 * UIProcess/API/qt/qquickwebview_p.h: 19 * UIProcess/API/qt/qquickwebview_p_p.h: 20 (QQuickWebViewPrivate): 21 * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp: 22 * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro: 23 * UIProcess/API/qt/tests/qmltests/WebView.pro: 24 * UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml: 25 * UIProcess/API/qt/tests/qmltests/common/link.html: Removed. 26 * UIProcess/API/qt/tests/qmltests/common/redirect.html: Removed. 27 * UIProcess/WebPageProxy.cpp: 28 (WebKit::WebPageProxy::activeURL): 29 * UIProcess/qt/QtWebPageLoadClient.cpp: 30 (WebKit::QtWebPageLoadClient::QtWebPageLoadClient): 31 (WebKit::QtWebPageLoadClient::didCommitLoad): 32 (WebKit::QtWebPageLoadClient::didSameDocumentNavigation): 33 (WebKit::QtWebPageLoadClient::dispatchLoadFailed): 34 (WebKit::QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame): 35 (WebKit::QtWebPageLoadClient::didFailLoadWithErrorForFrame): 36 * UIProcess/qt/QtWebPageLoadClient.h: 37 (QtWebPageLoadClient): 38 1 39 2012-05-02 Anders Carlsson <andersca@apple.com> 2 40 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r115830 r115862 51 51 #include <JavaScriptCore/InitializeThreading.h> 52 52 #include <QDateTime> 53 #include <QtQml/QQmlEngine>54 #include <QtQuick/QQuickCanvas>55 #include <WKOpenPanelResultListener.h>56 53 #include <WebCore/IntPoint.h> 57 54 #include <WebCore/IntRect.h> 58 #include <W ebCore/KURL.h>55 #include <WKOpenPanelResultListener.h> 59 56 #include <wtf/Assertions.h> 60 57 #include <wtf/MainThread.h> … … 238 235 void QQuickWebViewPrivate::onComponentComplete() 239 236 { 240 if (m_deferredUrlToLoad.isEmpty()) 241 return; 242 243 q_ptr->setUrl(m_deferredUrlToLoad); 244 m_deferredUrlToLoad.clear(); 237 if (m_deferedUrlToLoad.isEmpty()) 238 return; 239 240 q_ptr->setUrl(m_deferedUrlToLoad); 245 241 } 246 242 … … 1266 1262 { 1267 1263 Q_D(QQuickWebView); 1268 1269 WebFrameProxy* mainFrame = d->webPageProxy->mainFrame();1270 if (mainFrame && !mainFrame->unreachableURL().isEmpty() && mainFrame->url() != blankURL()) {1271 // We have an unreachable url, but haven't loaded alternative content1272 // for it (an error page eg.), so WebCore doesn't know about the unreachable1273 // url, and will try to reload the currently committed url instead. We don't1274 // want that, so we override the reload here by doing a manual load.1275 d->webPageProxy->loadURL(mainFrame->unreachableURL());1276 return;1277 }1278 1279 1264 const bool reloadFromOrigin = true; 1280 1265 d->webPageProxy->reload(reloadFromOrigin); … … 1284 1269 { 1285 1270 Q_D(const QQuickWebView); 1286 1287 if (!isComponentComplete()) 1288 return d->m_deferredUrlToLoad; 1289 1290 Q_ASSERT(d->m_currentUrl == d->webPageProxy->activeURL()); 1291 return QUrl(d->m_currentUrl); 1271 RefPtr<WebFrameProxy> mainFrame = d->webPageProxy->mainFrame(); 1272 if (!mainFrame) 1273 return QUrl(); 1274 return QUrl(QString(mainFrame->url())); 1292 1275 } 1293 1276 … … 1299 1282 return; 1300 1283 1301 if (!isComponentComplete()) 1302 d->m_deferredUrlToLoad = url; 1303 else 1304 d->webPageProxy->loadURL(url.toString()); 1305 1306 emitUrlChangeIfNeeded(); 1307 } 1308 1309 // Make sure we don't emit urlChanged unless it actually changed 1310 void QQuickWebView::emitUrlChangeIfNeeded() 1311 { 1312 Q_D(QQuickWebView); 1313 1314 WTF::String activeUrl = d->webPageProxy->activeURL(); 1315 if (activeUrl != d->m_currentUrl) { 1316 d->m_currentUrl = activeUrl; 1317 emit urlChanged(); 1284 if (!isComponentComplete()) { 1285 d->m_deferedUrlToLoad = url; 1286 return; 1318 1287 } 1288 1289 d->webPageProxy->loadURL(url.toString()); 1319 1290 } 1320 1291 … … 1667 1638 document are located relative to \a baseUrl. 1668 1639 1669 If an \a unreachableUrl is passed it is used as the url for the loaded1670 content. This is typically used to display error pages for a failed1671 load.1672 1673 1640 \sa WebView::url 1674 1641 */ 1675 1676 void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl, const QUrl& unreachableUrl) 1677 { 1678 Q_D(QQuickWebView); 1679 if (unreachableUrl.isValid()) 1680 d->webPageProxy->loadAlternateHTMLString(html, baseUrl.toString(), unreachableUrl.toString()); 1681 else 1682 d->webPageProxy->loadHTMLString(html, baseUrl.toString()); 1642 void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl) 1643 { 1644 Q_D(QQuickWebView); 1645 d->webPageProxy->loadHTMLString(html, baseUrl.toString()); 1683 1646 } 1684 1647 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
r115801 r115862 151 151 152 152 public Q_SLOTS: 153 void loadHtml(const QString& html, const QUrl& baseUrl = QUrl() , const QUrl& unreachableUrl = QUrl());153 void loadHtml(const QString& html, const QUrl& baseUrl = QUrl()); 154 154 155 155 void goBack(); … … 204 204 WKPageRef pageRef() const; 205 205 206 void emitUrlChangeIfNeeded();207 208 206 Q_PRIVATE_SLOT(d_func(), void _q_suspend()); 209 207 Q_PRIVATE_SLOT(d_func(), void _q_resume()); -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r115808 r115862 193 193 bool m_dialogActive; 194 194 QUrl m_iconURL; 195 QUrl m_deferredUrlToLoad; 196 WTF::String m_currentUrl; 195 QUrl m_deferedUrlToLoad; 197 196 }; 198 197 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
r115191 r115862 71 71 << "QQuickWebView.linkHovered(QUrl,QString) --> void" 72 72 << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void" 73 << "QQuickWebView.loadHtml(QString,QUrl,QUrl) --> void"74 73 << "QQuickWebView.loadHtml(QString,QUrl) --> void" 75 74 << "QQuickWebView.loadHtml(QString) --> void" -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro
r115191 r115862 16 16 17 17 OTHER_FILES += \ 18 DesktopBehavior/*.qml \ 19 common/* 18 DesktopBehavior/DesktopWebView.qml \ 19 DesktopBehavior/tst_linkHovered.qml \ 20 DesktopBehavior/tst_loadHtml.qml \ 21 DesktopBehavior/tst_messaging.qml \ 22 DesktopBehavior/tst_navigationRequested.qml \ 23 DesktopBehavior/tst_singleFileupload.qml \ 24 DesktopBehavior/tst_multiFileupload.qml -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro
r115191 r115862 15 15 16 16 OTHER_FILES += \ 17 WebView/tst_*.qml \ 18 common/* 17 WebView/tst_favIconLoad.qml \ 18 WebView/tst_download.qml \ 19 WebView/tst_geopermission.qml \ 20 WebView/tst_itemSelector.qml \ 21 WebView/tst_javaScriptDialogs.qml \ 22 WebView/tst_loadFail.qml \ 23 WebView/tst_loadIgnore.qml \ 24 WebView/tst_loadHtml.qml \ 25 WebView/tst_loadProgress.qml \ 26 WebView/tst_loadProgressSignal.qml \ 27 WebView/tst_preferences.qml \ 28 WebView/tst_properties.qml \ 29 WebView/tst_titleChanged.qml \ 30 WebView/tst_applicationScheme.qml \ 31 WebView/tst_origin.qml -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml
r115191 r115862 10 10 property int numLoadStarted: 0 11 11 property int numLoadSucceeded: 0 12 13 focus: true14 12 15 13 onLoadProgressChanged: { … … 30 28 id: test 31 29 name: "WebViewLoadUrl" 32 when: windowShown33 34 30 function test_loadIgnoreEmptyUrl() { 35 31 var url = Qt.resolvedUrl("../common/test1.html") … … 63 59 compare(webView.url, url) 64 60 } 65 66 function test_urlProperty() {67 var url = Qt.resolvedUrl("../common/test1.html")68 69 webView.url = url70 compare(webView.url, url)71 verify(webView.waitForLoadSucceeded())72 compare(webView.url, url)73 74 var bogusSite = "http://www.somesitethatdoesnotexist.abc/"75 webView.url = bogusSite76 compare(webView.url, bogusSite)77 verify(webView.waitForLoadFailed())78 compare(webView.url, bogusSite)79 80 webView.url = "about:blank" // Reset from previous test81 verify(webView.waitForLoadSucceeded())82 83 var handleLoadFailed = function(loadRequest) {84 if (loadRequest.status == WebView.LoadFailedStatus) {85 compare(webView.url, bogusSite)86 compare(loadRequest.url, bogusSite)87 webView.loadHtml("load failed", bogusSite, bogusSite)88 }89 }90 webView.loadingChanged.connect(handleLoadFailed)91 webView.url = bogusSite92 compare(webView.url, bogusSite)93 verify(webView.waitForLoadSucceeded())94 compare(webView.url, bogusSite)95 webView.loadingChanged.disconnect(handleLoadFailed)96 97 var dataUrl = "data:text/html,foo"98 webView.url = dataUrl99 compare(webView.url, dataUrl)100 101 var redirectUrl = Qt.resolvedUrl("../common/redirect.html")102 webView.url = redirectUrl103 compare(webView.url, redirectUrl)104 verify(webView.waitForLoadSucceeded())105 compare(webView.url, redirectUrl)106 verify(webView.waitForLoadSucceeded())107 compare(webView.url, url)108 109 var linkUrl = Qt.resolvedUrl("../common/link.html")110 webView.url = linkUrl111 compare(webView.url, linkUrl)112 verify(webView.waitForLoadSucceeded())113 compare(webView.url, linkUrl)114 webView.loadingChanged.connect(function(loadRequest) {115 compare(webView.url, loadRequest.url)116 compare(webView.url, url)117 })118 webView.forceActiveFocus()119 keyPress(Qt.Key_Return) // Link is focused120 verify(webView.waitForLoadSucceeded())121 compare(webView.url, url)122 }123 61 } 124 62 } -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r115191 r115862 658 658 String WebPageProxy::activeURL() const 659 659 { 660 if (!m_mainFrame) 661 return String(); 662 660 663 // If there is a currently pending url, it is the active URL. 661 664 if (!m_pendingAPIRequestURL.isNull()) 662 665 return m_pendingAPIRequestURL; 663 664 if (!m_mainFrame)665 return String();666 666 667 667 if (!m_mainFrame->unreachableURL().isEmpty()) -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
r115808 r115862 45 45 loadClient.clientInfo = this; 46 46 loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame; 47 loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;48 47 loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame; 49 48 loadClient.didCommitLoadForFrame = didCommitLoadForFrame; … … 76 75 { 77 76 QWebLoadRequest loadRequest(url, QQuickWebView::LoadStartedStatus); 78 m_webView->emitUrlChangeIfNeeded();79 77 emit m_webView->loadingChanged(&loadRequest); 80 78 } 81 79 82 void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const QUrl& url)83 {84 m_webView->emitUrlChangeIfNeeded();85 }86 87 80 void QtWebPageLoadClient::didCommitLoad() 88 81 { 89 82 emit m_webView->navigationHistoryChanged(); 83 emit m_webView->urlChanged(); 90 84 emit m_webView->titleChanged(); 91 85 m_webView->d_func()->loadDidCommit(); … … 94 88 void QtWebPageLoadClient::didSameDocumentNavigation() 95 89 { 96 m_webView->emitUrlChangeIfNeeded();97 90 emit m_webView->navigationHistoryChanged(); 91 emit m_webView->urlChanged(); 98 92 } 99 93 … … 118 112 } 119 113 120 void QtWebPageLoadClient::dispatchLoadFailed(WK FrameRef frame, WKErrorRef error)114 void QtWebPageLoadClient::dispatchLoadFailed(WKErrorRef error) 121 115 { 122 116 int errorCode = WKErrorGetErrorCode(error); 123 117 if (toImpl(error)->platformError().isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) { 124 // The active url might have changed125 m_webView->emitUrlChangeIfNeeded();126 127 118 // Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download. 128 119 dispatchLoadSucceeded(); 129 130 120 return; 131 121 } 132 122 133 123 QtWebError qtError(error); 134 135 // We set the unreachable url unconditionally so that the current136 // active url of the webview when the loadingChanged signal is137 // emitted reflects the failed url, not the previously committed138 // url. This also ensures that if the user does not do a loadHtml139 // with an error page and and unreachable url, as a reponse to the140 // failed load, we can still detect the failed url for reloads.141 WebFrameProxy* wkframe = toImpl(frame);142 wkframe->setUnreachableURL(toImpl(error)->failingURL());143 m_webView->emitUrlChangeIfNeeded();144 145 124 QWebLoadRequest loadRequest(qtError.url(), QQuickWebView::LoadFailedStatus, qtError.description(), static_cast<QQuickWebView::ErrorDomain>(qtError.type()), qtError.errorCode()); 146 125 emit m_webView->loadingChanged(&loadRequest); … … 169 148 } 170 149 171 void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)172 {173 if (!WKFrameIsMainFrame(frame))174 return;175 WebFrameProxy* wkframe = toImpl(frame);176 QString urlStr(wkframe->provisionalURL());177 QUrl qUrl = urlStr;178 toQtWebPageLoadClient(clientInfo)->didReceiveServerRedirectForProvisionalLoad(qUrl);179 }180 181 150 void QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) 182 151 { 183 152 if (!WKFrameIsMainFrame(frame)) 184 153 return; 185 186 toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(frame, error); 154 toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error); 187 155 } 188 156 … … 205 173 if (!WKFrameIsMainFrame(frame)) 206 174 return; 207 toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed( frame,error);175 toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error); 208 176 } 209 177 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h
r115808 r115862 44 44 private: 45 45 void didStartProvisionalLoad(const QUrl&); 46 void didReceiveServerRedirectForProvisionalLoad(const QUrl&);47 46 void didCommitLoad(); 48 47 void didSameDocumentNavigation(); … … 52 51 53 52 void dispatchLoadSucceeded(); 54 void dispatchLoadFailed(WK FrameRef, WKErrorRef);53 void dispatchLoadFailed(WKErrorRef); 55 54 56 55 void setLoadProgress(int); … … 58 57 // WKPageLoadClient callbacks. 59 58 static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); 60 static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);61 59 static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo); 62 60 static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); -
trunk/Tools/ChangeLog
r115853 r115862 1 2012-05-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 3 Revert r115191 - "Make the web view's url property follow the active url" 4 5 It uncovered/caused issues in the icon-implementation that can't be 6 easily fixed, so rolling out instead. 7 8 https://bugs.webkit.org/show_bug.cgi?id=77554 9 10 Rubber-stamped by Simon Hausmann. 11 12 * MiniBrowser/qt/qml/BrowserWindow.qml: 13 * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp: 14 (TestWebKitAPI::TEST): 15 1 16 2012-05-02 Zan Dobersek <zandobersek@gmail.com> 2 17 -
trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml
r115727 r115862 42 42 function load(address) { 43 43 webView.url = address 44 webView.forceActiveFocus()45 44 } 46 45 47 46 function reload() { 48 47 webView.reload() 49 webView.forceActiveFocus()50 48 } 51 49 … … 254 252 } 255 253 radius: 3 256 width: parent.width / 100 * Math.max(5, webView.loadProgress)254 width: parent.width / 100 * webView.loadProgress 257 255 color: "blue" 258 256 opacity: 0.3 259 visible: webView.load ing257 visible: webView.loadProgress != 100 260 258 } 261 259 Image { … … 274 272 clip: true 275 273 selectByMouse: true 276 horizontalAlignment: TextInput.AlignLeft277 274 font { 278 275 pointSize: 11 … … 287 284 288 285 Keys.onReturnPressed:{ 289 console.log("Navigating to: ", addressLine.text) 290 load(utils.urlFromUserInput(addressLine.text)) 291 } 292 293 property url url 294 295 onUrlChanged: { 296 if (activeFocus) 297 return; 298 299 text = url 300 cursorPosition = 0 301 } 302 303 onActiveFocusChanged: url = webView.url 286 console.log("going to: ", addressLine.text) 287 webView.url = utils.urlFromUserInput(addressLine.text) 288 } 304 289 } 305 290 } … … 317 302 onTitleChanged: pageTitleChanged(title) 318 303 onUrlChanged: { 319 addressLine.url = webView.url 320 304 addressLine.text = url 321 305 if (options.printLoadedUrls) 322 console.log("WebView url changed:", webView.url.toString()); 323 } 324 325 onLoadingChanged: { 326 if (!loading && loadRequest.status == WebView.LoadFailedStatus) 327 webView.loadHtml("Failed to load " + loadRequest.url, "", loadRequest.url) 306 console.log("Loaded:", webView.url.toString()); 307 forceActiveFocus(); 328 308 } 329 309 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp
r115191 r115862 139 139 WKPageLoadURL(webView.page(), url.get()); 140 140 141 WKRetainPtr<WKURLRef> activeUrl = adoptWK(WKPageCopyActiveURL(webView.page()));142 ASSERT_NOT_NULL(activeUrl.get());143 EXPECT_TRUE(WKURLIsEqual(activeUrl.get(), url.get()));144 145 141 Util::run(&test1Done); 146 142 }
Note: See TracChangeset
for help on using the changeset viewer.