Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativexmlhttprequest / data / send_alreadySent.qml
1 import QtQuick 1.0
2
3 QtObject {
4     property bool dataOK: false
5     property bool test: false
6
7     Component.onCompleted: {
8         var x = new XMLHttpRequest;
9         x.open("GET", "testdocument.html");
10         x.setRequestHeader("Accept-Language","en-US");
11
12         // Test to the end
13         x.onreadystatechange = function() {
14             if (x.readyState == XMLHttpRequest.DONE) {
15                 dataOK = (x.responseText == "QML Rocks!\n");
16             }
17         }
18
19         x.send();
20
21         try {
22             x.send()        
23         } catch (e) {
24             if (e.code == DOMException.INVALID_STATE_ERR)
25                 test = true;
26         }
27     }
28 }