Different behavior of SpeedOf.Me API on QtWebKit and other bindings and browsers

I am trying to use the SpeedOf.Me API in a Qt application with QtWebKit. Unfortunately, the speed test does not work correctly. Exactly when I open http://speedof.me/api/doc/sample_advanced.html in WebView and click on Start Test, then:

  • download test works well (SomApi.onProgress with progress.type = "download")
  • then the β€œTest Result” is displayed with a reasonable download speed, but with a very strange download speed (SomApi.onTestCompleted).
  • Ultimately, the download starts with the download (SomApi.onProgress with progress.type = "upload")

The test result is not updated after the boot test. In a normal scenario, the order should be, of course: loading the test, loading the test, and then displaying the results. Am I doing something wrong or is it the way Qt WebKit is believed to work? Can you suggest a workaround?

Since the URL is fundamental in the code below and I cannot post the link more than two times, I replaced all occurrences of http://speedof.me/api/doc/sample_advanced.html with __URL__.

How to reproduce this error?

Qt WebKit, Qt Quick code (Arch Linux, qml binary version 1.0, Qt 5.2.1), Qt Widgets ( Arch Linux Qt5 Ubuntu 12.04 Qt4), - Arora Qt ( Arch repo).

import QtQuick 2.0
import QtQuick.Controls 1.0
import QtWebKit 3.0

ScrollView {
    width: 1280
    height: 720
    WebView {
        id: webview
        url: "__URL__"
        anchors.fill: parent
        onNavigationRequested: {
            // detect URL scheme prefix, most likely an external link
            var schemaRE = /^\w+:/;
            if (schemaRE.test(request.url)) {
                request.action = WebView.AcceptRequest;
            } else {
                request.action = WebView.IgnoreRequest;
                // delegate request.url here
            }
        }
   }
}

?

script - ( Chromium, Firefox, Safari), GTK WebKit.

from gi.repository import Gtk, WebKit
win = Gtk.Window()
view = WebKit.WebView()
view.load_uri("__URL__")
win.add(view)
win.show_all()
Gtk.main()

(Python 3.4.0, WebKit 2.4.1, gi 3.12.1)

?

SpeedOf.Me. .

XHR2

, , , . , , . SpeedOf.Me , " AJAX 2". WebKit ( , speedtest ). ( , HTML5 ( FormData)?, , XHR2 AJAX 2 , ?

> Date: Thu May 15 2014 core.js:8
> Ver: 2.7 core.js:8
> URL: __URL__ core.js:8
> User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) view Safari/538.1 core.js:8
window.FormData
FormDataConstructor {prototype: FormDataPrototype}
var xhr = new XMLHttpRequest()
undefined
xhr
XMLHttpRequest {readyState: 0, timeout: 0, onloadend: null, withCredentials: false, onloadstart: null…}
('upload' in xhr) && ('onprogress' in xhr)
true
new XMLHttpRequest().upload
XMLHttpRequestUpload {onabort: null, onload: null, onprogress: null, onerror: null, onloadstart: null…}

UserAgent

UserAgent .

+4

Source: https://habr.com/ru/post/1542167/


All Articles