0
|
1 /**
|
|
2 * Sinon.JS 1.12.1, 2014/11/16
|
|
3 *
|
|
4 * @author Christian Johansen ([email protected])
|
|
5 * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
|
|
6 *
|
|
7 * (The BSD License)
|
|
8 *
|
|
9 * Copyright (c) 2010-2014, Christian Johansen, [email protected]
|
|
10 * All rights reserved.
|
|
11 *
|
|
12 * Redistribution and use in source and binary forms, with or without modification,
|
|
13 * are permitted provided that the following conditions are met:
|
|
14 *
|
|
15 * * Redistributions of source code must retain the above copyright notice,
|
|
16 * this list of conditions and the following disclaimer.
|
|
17 * * Redistributions in binary form must reproduce the above copyright notice,
|
|
18 * this list of conditions and the following disclaimer in the documentation
|
|
19 * and/or other materials provided with the distribution.
|
|
20 * * Neither the name of Christian Johansen nor the names of his contributors
|
|
21 * may be used to endorse or promote products derived from this software
|
|
22 * without specific prior written permission.
|
|
23 *
|
|
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 */
|
|
35
|
|
36 /**
|
|
37 * Helps IE run the fake timers. By defining global functions, IE allows
|
|
38 * them to be overwritten at a later point. If these are not defined like
|
|
39 * this, overwriting them will result in anything from an exception to browser
|
|
40 * crash.
|
|
41 *
|
|
42 * If you don't require fake timers to work in IE, don't include this file.
|
|
43 *
|
|
44 * @author Christian Johansen ([email protected])
|
|
45 * @license BSD
|
|
46 *
|
|
47 * Copyright (c) 2010-2013 Christian Johansen
|
|
48 */
|
|
49 function setTimeout() {}
|
|
50 function clearTimeout() {}
|
|
51 function setImmediate() {}
|
|
52 function clearImmediate() {}
|
|
53 function setInterval() {}
|
|
54 function clearInterval() {}
|
|
55 function Date() {}
|
|
56
|
|
57 // Reassign the original functions. Now their writable attribute
|
|
58 // should be true. Hackish, I know, but it works.
|
|
59 setTimeout = sinon.timers.setTimeout;
|
|
60 clearTimeout = sinon.timers.clearTimeout;
|
|
61 setImmediate = sinon.timers.setImmediate;
|
|
62 clearImmediate = sinon.timers.clearImmediate;
|
|
63 setInterval = sinon.timers.setInterval;
|
|
64 clearInterval = sinon.timers.clearInterval;
|
|
65 Date = sinon.timers.Date;
|
|
66
|
|
67 /**
|
|
68 * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows
|
|
69 * them to be overwritten at a later point. If these are not defined like
|
|
70 * this, overwriting them will result in anything from an exception to browser
|
|
71 * crash.
|
|
72 *
|
|
73 * If you don't require fake XHR to work in IE, don't include this file.
|
|
74 *
|
|
75 * @author Christian Johansen ([email protected])
|
|
76 * @license BSD
|
|
77 *
|
|
78 * Copyright (c) 2010-2013 Christian Johansen
|
|
79 */
|
|
80 function XMLHttpRequest() {}
|
|
81
|
|
82 // Reassign the original function. Now its writable attribute
|
|
83 // should be true. Hackish, I know, but it works.
|
|
84 XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined;
|
|
85 /**
|
|
86 * Helps IE run the fake XDomainRequest. By defining global functions, IE allows
|
|
87 * them to be overwritten at a later point. If these are not defined like
|
|
88 * this, overwriting them will result in anything from an exception to browser
|
|
89 * crash.
|
|
90 *
|
|
91 * If you don't require fake XDR to work in IE, don't include this file.
|
|
92 */
|
|
93 function XDomainRequest() {}
|
|
94
|
|
95 // Reassign the original function. Now its writable attribute
|
|
96 // should be true. Hackish, I know, but it works.
|
|
97 XDomainRequest = sinon.xdr.XDomainRequest || undefined;
|