Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50752

QWebEnginePage::toPlainText result unreliable after load error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.1
    • 5.6.0 Beta
    • WebEngine
    • None

    Description

      How to reproduce:

      • load a page successfully
      • load a page with an unhandled URL scheme
      • load a page successfully
      • extract the page's text

      "Very often" the text will be the content of the error page for the second, failed, load.

      Excerpt from the attachment:

      for (;;) {
          QWebEngineView view;
          QSignalSpy spy(&view, SIGNAL(loadFinished(bool)));
      
          view.load(QUrl("data:text/plain,foobarbaz"));
          QTRY_VERIFY(spy.count());
          QCOMPARE(toPlainTextSync(view), QString("foobarbaz"));
      
          view.load(QUrl("fail:unknown/scheme"));
          QTRY_VERIFY(spy.count() > 1);
          QString s = toPlainTextSync(view);
          qDebug() << s;
          QVERIFY(!s.contains("foobarbaz"));
      
          view.load(QUrl("data:text/plain,lalala"));
          QTRY_VERIFY(spy.count() > 2);
          QCOMPARE(toPlainTextSync(view), QString("lalala"));
      }
      

      After some iterations the test fails with

      FAIL!  : ToPlainTextFailTest::doit() Compared values are not the same
         Actual   (toPlainTextSync(view)): "\nThis webpage is not available\n\nERR_UNKNOWN_URL_SCHEME\nDetails"
         Expected (QString("lalala"))    : "lalala"
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes