summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml
blob: cee07d6de65f9d9555c7b9f293c99d91c523d699 (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 Qt 4.7

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();
    }
}