Changeset 115862 in webkit


Ignore:
Timestamp:
May 2, 2012 12:19:24 PM (12 years ago)
Author:
vestbo@webkit.org
Message:

Revert r115191 - "Make the web view's url property follow the active url"

It uncovered/caused issues in the icon-implementation that can't be
easily fixed, so rolling out instead.

https://bugs.webkit.org/show_bug.cgi?id=77554

Rubber-stamped by Simon Hausmann.

Location:
trunk
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r115859 r115862  
     12012-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
    1392012-05-02  Anders Carlsson  <andersca@apple.com>
    240
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r115830 r115862  
    5151#include <JavaScriptCore/InitializeThreading.h>
    5252#include <QDateTime>
    53 #include <QtQml/QQmlEngine>
    54 #include <QtQuick/QQuickCanvas>
    55 #include <WKOpenPanelResultListener.h>
    5653#include <WebCore/IntPoint.h>
    5754#include <WebCore/IntRect.h>
    58 #include <WebCore/KURL.h>
     55#include <WKOpenPanelResultListener.h>
    5956#include <wtf/Assertions.h>
    6057#include <wtf/MainThread.h>
     
    238235void QQuickWebViewPrivate::onComponentComplete()
    239236{
    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);
    245241}
    246242
     
    12661262{
    12671263    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 content
    1272         // for it (an error page eg.), so WebCore doesn't know about the unreachable
    1273         // url, and will try to reload the currently committed url instead. We don't
    1274         // want that, so we override the reload here by doing a manual load.
    1275         d->webPageProxy->loadURL(mainFrame->unreachableURL());
    1276         return;
    1277     }
    1278 
    12791264    const bool reloadFromOrigin = true;
    12801265    d->webPageProxy->reload(reloadFromOrigin);
     
    12841269{
    12851270    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()));
    12921275}
    12931276
     
    12991282        return;
    13001283
    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;
    13181287    }
     1288
     1289    d->webPageProxy->loadURL(url.toString());
    13191290}
    13201291
     
    16671638    document are located relative to \a baseUrl.
    16681639
    1669     If an \a unreachableUrl is passed it is used as the url for the loaded
    1670     content. This is typically used to display error pages for a failed
    1671     load.
    1672 
    16731640    \sa WebView::url
    16741641*/
    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());
     1642void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl)
     1643{
     1644    Q_D(QQuickWebView);
     1645    d->webPageProxy->loadHTMLString(html, baseUrl.toString());
    16831646}
    16841647
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h

    r115801 r115862  
    151151
    152152public 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());
    154154
    155155    void goBack();
     
    204204    WKPageRef pageRef() const;
    205205
    206     void emitUrlChangeIfNeeded();
    207 
    208206    Q_PRIVATE_SLOT(d_func(), void _q_suspend());
    209207    Q_PRIVATE_SLOT(d_func(), void _q_resume());
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r115808 r115862  
    193193    bool m_dialogActive;
    194194    QUrl m_iconURL;
    195     QUrl m_deferredUrlToLoad;
    196     WTF::String m_currentUrl;
     195    QUrl m_deferedUrlToLoad;
    197196};
    198197
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp

    r115191 r115862  
    7171    << "QQuickWebView.linkHovered(QUrl,QString) --> void"
    7272    << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void"
    73     << "QQuickWebView.loadHtml(QString,QUrl,QUrl) --> void"
    7473    << "QQuickWebView.loadHtml(QString,QUrl) --> void"
    7574    << "QQuickWebView.loadHtml(QString) --> void"
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro

    r115191 r115862  
    1616
    1717OTHER_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  
    1515
    1616OTHER_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  
    1010    property int numLoadStarted: 0
    1111    property int numLoadSucceeded: 0
    12 
    13     focus: true
    1412
    1513    onLoadProgressChanged: {
     
    3028        id: test
    3129        name: "WebViewLoadUrl"
    32         when: windowShown
    33 
    3430        function test_loadIgnoreEmptyUrl() {
    3531            var url = Qt.resolvedUrl("../common/test1.html")
     
    6359            compare(webView.url, url)
    6460        }
    65 
    66         function test_urlProperty() {
    67             var url = Qt.resolvedUrl("../common/test1.html")
    68 
    69             webView.url = url
    70             compare(webView.url, url)
    71             verify(webView.waitForLoadSucceeded())
    72             compare(webView.url, url)
    73 
    74             var bogusSite = "http://www.somesitethatdoesnotexist.abc/"
    75             webView.url = bogusSite
    76             compare(webView.url, bogusSite)
    77             verify(webView.waitForLoadFailed())
    78             compare(webView.url, bogusSite)
    79 
    80             webView.url = "about:blank" // Reset from previous test
    81             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 = bogusSite
    92             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 = dataUrl
    99             compare(webView.url, dataUrl)
    100 
    101             var redirectUrl = Qt.resolvedUrl("../common/redirect.html")
    102             webView.url = redirectUrl
    103             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 = linkUrl
    111             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 focused
    120             verify(webView.waitForLoadSucceeded())
    121             compare(webView.url, url)
    122         }
    12361    }
    12462}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r115191 r115862  
    658658String WebPageProxy::activeURL() const
    659659{
     660    if (!m_mainFrame)
     661        return String();
     662
    660663    // If there is a currently pending url, it is the active URL.
    661664    if (!m_pendingAPIRequestURL.isNull())
    662665        return m_pendingAPIRequestURL;
    663 
    664     if (!m_mainFrame)
    665         return String();
    666666
    667667    if (!m_mainFrame->unreachableURL().isEmpty())
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp

    r115808 r115862  
    4545    loadClient.clientInfo = this;
    4646    loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
    47     loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
    4847    loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
    4948    loadClient.didCommitLoadForFrame = didCommitLoadForFrame;
     
    7675{
    7776    QWebLoadRequest loadRequest(url, QQuickWebView::LoadStartedStatus);
    78     m_webView->emitUrlChangeIfNeeded();
    7977    emit m_webView->loadingChanged(&loadRequest);
    8078}
    8179
    82 void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const QUrl& url)
    83 {
    84     m_webView->emitUrlChangeIfNeeded();
    85 }
    86 
    8780void QtWebPageLoadClient::didCommitLoad()
    8881{
    8982    emit m_webView->navigationHistoryChanged();
     83    emit m_webView->urlChanged();
    9084    emit m_webView->titleChanged();
    9185    m_webView->d_func()->loadDidCommit();
     
    9488void QtWebPageLoadClient::didSameDocumentNavigation()
    9589{
    96     m_webView->emitUrlChangeIfNeeded();
    9790    emit m_webView->navigationHistoryChanged();
     91    emit m_webView->urlChanged();
    9892}
    9993
     
    118112}
    119113
    120 void QtWebPageLoadClient::dispatchLoadFailed(WKFrameRef frame, WKErrorRef error)
     114void QtWebPageLoadClient::dispatchLoadFailed(WKErrorRef error)
    121115{
    122116    int errorCode = WKErrorGetErrorCode(error);
    123117    if (toImpl(error)->platformError().isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
    124         // The active url might have changed
    125         m_webView->emitUrlChangeIfNeeded();
    126 
    127118        // Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download.
    128119        dispatchLoadSucceeded();
    129 
    130120        return;
    131121    }
    132122
    133123    QtWebError qtError(error);
    134 
    135     // We set the unreachable url unconditionally so that the current
    136     // active url of the webview when the loadingChanged signal is
    137     // emitted reflects the failed url, not the previously committed
    138     // url. This also ensures that if the user does not do a loadHtml
    139     // with an error page and and unreachable url, as a reponse to the
    140     // 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 
    145124    QWebLoadRequest loadRequest(qtError.url(), QQuickWebView::LoadFailedStatus, qtError.description(), static_cast<QQuickWebView::ErrorDomain>(qtError.type()), qtError.errorCode());
    146125    emit m_webView->loadingChanged(&loadRequest);
     
    169148}
    170149
    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 
    181150void QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
    182151{
    183152    if (!WKFrameIsMainFrame(frame))
    184153        return;
    185 
    186     toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(frame, error);
     154    toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error);
    187155}
    188156
     
    205173    if (!WKFrameIsMainFrame(frame))
    206174        return;
    207     toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(frame, error);
     175    toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error);
    208176}
    209177
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h

    r115808 r115862  
    4444private:
    4545    void didStartProvisionalLoad(const QUrl&);
    46     void didReceiveServerRedirectForProvisionalLoad(const QUrl&);
    4746    void didCommitLoad();
    4847    void didSameDocumentNavigation();
     
    5251
    5352    void dispatchLoadSucceeded();
    54     void dispatchLoadFailed(WKFrameRef, WKErrorRef);
     53    void dispatchLoadFailed(WKErrorRef);
    5554
    5655    void setLoadProgress(int);
     
    5857    // WKPageLoadClient callbacks.
    5958    static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
    60     static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
    6159    static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
    6260    static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
  • trunk/Tools/ChangeLog

    r115853 r115862  
     12012-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
    1162012-05-02  Zan Dobersek  <zandobersek@gmail.com>
    217
  • trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml

    r115727 r115862  
    4242    function load(address) {
    4343        webView.url = address
    44         webView.forceActiveFocus()
    4544    }
    4645
    4746    function reload() {
    4847        webView.reload()
    49         webView.forceActiveFocus()
    5048    }
    5149
     
    254252                }
    255253                radius: 3
    256                 width: parent.width / 100 * Math.max(5, webView.loadProgress)
     254                width: parent.width / 100 * webView.loadProgress
    257255                color: "blue"
    258256                opacity: 0.3
    259                 visible: webView.loading
     257                visible: webView.loadProgress != 100
    260258            }
    261259            Image {
     
    274272                clip: true
    275273                selectByMouse: true
    276                 horizontalAlignment: TextInput.AlignLeft
    277274                font {
    278275                    pointSize: 11
     
    287284
    288285                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                }
    304289            }
    305290        }
     
    317302        onTitleChanged: pageTitleChanged(title)
    318303        onUrlChanged: {
    319             addressLine.url = webView.url
    320 
     304            addressLine.text = url
    321305            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();
    328308        }
    329309
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp

    r115191 r115862  
    139139    WKPageLoadURL(webView.page(), url.get());
    140140
    141     WKRetainPtr<WKURLRef> activeUrl = adoptWK(WKPageCopyActiveURL(webView.page()));
    142     ASSERT_NOT_NULL(activeUrl.get());
    143     EXPECT_TRUE(WKURLIsEqual(activeUrl.get(), url.get()));
    144 
    145141    Util::run(&test1Done);
    146142}
Note: See TracChangeset for help on using the changeset viewer.