summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml
blob: ec6902dc451f6048e567e2829e4782f18dcd7dd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import QtQuick 1.0

QtObject {
    id: obj
    property string url
    property string which
    property bool threw: false

    onWhichChanged: {
        var x = new XMLHttpRequest;

        x.onreadystatechange = function() {
            if (x.readyState == which) {
                obj.threw = true
                throw(new Error("Exception from Callback"))
            }
        }

        x.open("GET", url);
        x.setRequestHeader("Test-header", "TestValue");
        x.send();
    }
}