tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 import Qt 4.7
       
     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 }