~ubuntu-branches/ubuntu/saucy/qtdeclarative-opensource-src/saucy

« back to all changes in this revision

Viewing changes to tests/auto/qml/qqmlxmlhttprequest/data/callbackException.qml

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
 
 
3
QtObject {
 
4
    id: obj
 
5
    property string url
 
6
    property string which
 
7
    property bool threw: false
 
8
 
 
9
    onWhichChanged: {
 
10
        var x = new XMLHttpRequest;
 
11
 
 
12
        x.onreadystatechange = function() {
 
13
            if (x.readyState == which) {
 
14
                obj.threw = true
 
15
                throw(new Error("Exception from Callback"))
 
16
            }
 
17
        }
 
18
 
 
19
        x.open("GET", url);
 
20
        x.setRequestHeader("Test-header", "TestValue");
 
21
        x.send();
 
22
    }
 
23
}
 
24
 
 
25