vendor/assets/javascripts/sinon.js in sinon-rails-1.9.0 vs vendor/assets/javascripts/sinon.js in sinon-rails-1.10.3

- old
+ new

@@ -1,7 +1,7 @@ /** - * Sinon.JS 1.9.0, 2014/03/05 + * Sinon.JS 1.10.3, 2014/07/11 * * @author Christian Johansen (christian@cjohansen.no) * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS * * (The BSD License) @@ -33,12 +33,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ this.sinon = (function () { var samsam, formatio; -function define(mod, deps, fn) { if (mod == "samsam") { samsam = deps(); } else { formatio = fn(samsam); } } -define.amd = true; +function define(mod, deps, fn) { if (mod == "samsam") { samsam = deps(); } else if (typeof fn === "function") { formatio = fn(samsam); } } +define.amd = {}; ((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || (typeof module === "object" && function (m) { module.exports = m(); }) || // Node function (m) { this.samsam = m(); } // Browser globals )(function () { @@ -653,10 +653,14 @@ function isFunction(obj) { return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); } + function isReallyNaN(val) { + return typeof val === 'number' && isNaN(val); + } + function mirrorProperties(target, source) { for (var prop in source) { if (!hasOwn.call(target, prop)) { target[prop] = source[prop]; } @@ -681,23 +685,19 @@ error; if (!isFunction(wrappedMethod)) { error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + property + " as function"); - } - - if (wrappedMethod.restore && wrappedMethod.restore.sinon) { + } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } - - if (wrappedMethod.calledBefore) { + } else if (wrappedMethod.calledBefore) { var verb = !!wrappedMethod.returns ? "stubbed" : "spied on"; error = new TypeError("Attempted to wrap " + property + " which is already " + verb); } if (error) { - if (wrappedMethod._stack) { + if (wrappedMethod && wrappedMethod._stack) { error.stack += '\n--------------\n' + wrappedMethod._stack; } throw error; } @@ -754,12 +754,17 @@ deepEqual: function deepEqual(a, b) { if (sinon.match && sinon.match.isMatcher(a)) { return a.test(b); } - if (typeof a != "object" || typeof b != "object") { - return a === b; + + if (typeof a != 'object' || typeof b != 'object') { + if (isReallyNaN(a) && isReallyNaN(b)) { + return true; + } else { + return a === b; + } } if (isElement(a) || isElement(b)) { return a === b; } @@ -771,11 +776,11 @@ if ((a === null && b !== null) || (a !== null && b === null)) { return false; } if (a instanceof RegExp && b instanceof RegExp) { - return (a.source === b.source) && (a.global === b.global) && + return (a.source === b.source) && (a.global === b.global) && (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline); } var aString = Object.prototype.toString.call(a); if (aString != Object.prototype.toString.call(b)) { @@ -793,10 +798,14 @@ } for (prop in a) { aLength += 1; + if (!(prop in b)) { + return false; + } + if (!deepEqual(a[prop], b[prop])) { return false; } } @@ -938,34 +947,35 @@ object.restore(); } } }; - var isNode = typeof module !== "undefined" && module.exports; + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; var isAMD = typeof define === 'function' && typeof define.amd === 'object' && define.amd; + function makePublicAPI(require, exports, module) { + module.exports = sinon; + sinon.spy = require("./sinon/spy"); + sinon.spyCall = require("./sinon/call"); + sinon.behavior = require("./sinon/behavior"); + sinon.stub = require("./sinon/stub"); + sinon.mock = require("./sinon/mock"); + sinon.collection = require("./sinon/collection"); + sinon.assert = require("./sinon/assert"); + sinon.sandbox = require("./sinon/sandbox"); + sinon.test = require("./sinon/test"); + sinon.testCase = require("./sinon/test_case"); + sinon.match = require("./sinon/match"); + } + if (isAMD) { - define(function(){ - return sinon; - }); + define(makePublicAPI); } else if (isNode) { try { formatio = require("formatio"); } catch (e) {} - module.exports = sinon; - module.exports.spy = require("./sinon/spy"); - module.exports.spyCall = require("./sinon/call"); - module.exports.behavior = require("./sinon/behavior"); - module.exports.stub = require("./sinon/stub"); - module.exports.mock = require("./sinon/mock"); - module.exports.collection = require("./sinon/collection"); - module.exports.assert = require("./sinon/assert"); - module.exports.sandbox = require("./sinon/sandbox"); - module.exports.test = require("./sinon/test"); - module.exports.testCase = require("./sinon/test_case"); - module.exports.assert = require("./sinon/assert"); - module.exports.match = require("./sinon/match"); + makePublicAPI(require, exports, module); } if (formatio) { var formatter = formatio.configure({ quoteStrings: false }); sinon.format = function () { @@ -997,11 +1007,11 @@ * * Copyright (c) 2012 Maximilian Antoni */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } @@ -1220,14 +1230,16 @@ match.func = match.typeOf("function"); match.array = match.typeOf("array"); match.regexp = match.typeOf("regexp"); match.date = match.typeOf("date"); - if (commonJSModule) { + sinon.match = match; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = match; }); + } else if (commonJSModule) { module.exports = match; - } else { - sinon.match = match; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -1245,11 +1257,11 @@ * Copyright (c) 2010-2013 Christian Johansen * Copyright (c) 2013 Maximilian Antoni */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } if (!sinon) { @@ -1422,14 +1434,16 @@ return proxyCall; } createSpyCall.toString = callProto.toString; // used by mocks - if (commonJSModule) { + sinon.spyCall = createSpyCall; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = createSpyCall; }); + } else if (commonJSModule) { module.exports = createSpyCall; - } else { - sinon.spyCall = createSpyCall; } }(typeof sinon == "object" && sinon || null)); /** @@ -1446,11 +1460,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; var push = Array.prototype.push; var slice = Array.prototype.slice; var callId = 0; if (!sinon && commonJSModule) { @@ -1577,10 +1591,13 @@ incrementCallCount.call(this); push.call(this.thisValues, thisValue); push.call(this.args, args); push.call(this.callIds, callId++); + // Make call properties available from within the spied function: + createCallProperties.call(this); + try { if (matching) { returnValue = matching.invoke(func, thisValue, args); } else { returnValue = (this.func || func).apply(thisValue, args); @@ -1595,19 +1612,25 @@ } push.call(this.exceptions, exception); push.call(this.returnValues, returnValue); + // Make return value and exception available in the calls: createCallProperties.call(this); if (exception !== undefined) { throw exception; } return returnValue; }, + named: function named(name) { + this.displayName = name; + return this; + }, + getCall: function getCall(i) { if (i < 0 || i >= this.callCount) { return null; } @@ -1829,15 +1852,16 @@ }; sinon.extend(spy, spyApi); spy.spyCall = sinon.spyCall; + sinon.spy = spy; - if (commonJSModule) { + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = spy; }); + } else if (commonJSModule) { module.exports = spy; - } else { - sinon.spy = spy; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -1853,11 +1877,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } @@ -2162,16 +2186,19 @@ }; })(method); } } - if (commonJSModule) { + sinon.behavior = proto; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = proto; }); + } else if (commonJSModule) { module.exports = proto; - } else { - sinon.behavior = proto; } }(typeof sinon == "object" && sinon || null)); + /** * @depend ../sinon.js * @depend spy.js * @depend behavior.js */ @@ -2185,11 +2212,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } @@ -2320,14 +2347,16 @@ } return proto; }())); - if (commonJSModule) { + sinon.stub = stub; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = stub; }); + } else if (commonJSModule) { module.exports = stub; - } else { - sinon.stub = stub; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -2343,11 +2372,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; var push = [].push; var match; if (!sinon && commonJSModule) { sinon = require("../sinon"); @@ -2769,14 +2798,16 @@ throw exception; } }; }()); - if (commonJSModule) { + sinon.mock = mock; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = mock; }); + } else if (commonJSModule) { module.exports = mock; - } else { - sinon.mock = mock; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -2793,11 +2824,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; var push = [].push; var hasOwnProperty = Object.prototype.hasOwnProperty; if (!sinon && commonJSModule) { sinon = require("../sinon"); @@ -2922,14 +2953,16 @@ return obj; } }; - if (commonJSModule) { + sinon.collection = collection; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = collection; }); + } else if (commonJSModule) { module.exports = collection; - } else { - sinon.collection = collection; } }(typeof sinon == "object" && sinon || null)); /*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/ /*global module, require, window*/ @@ -2954,10 +2987,17 @@ if (typeof sinon == "undefined") { var sinon = {}; } (function (global) { + // node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref() + // browsers, a number. + // see https://github.com/cjohansen/Sinon.JS/pull/436 + var timeoutResult = setTimeout(function() {}, 0); + var addTimerReturnsObject = typeof timeoutResult === 'object'; + clearTimeout(timeoutResult); + var id = 1; function addTimer(args, recurring) { if (args.length === 0) { throw new Error("Function requires at least 1 parameter"); @@ -2983,11 +3023,20 @@ if (recurring === true) { this.timeouts[toId].interval = delay; } - return toId; + if (addTimerReturnsObject) { + return { + id: toId, + ref: function() {}, + unref: function() {} + }; + } + else { + return toId; + } } function parseTime(str) { if (!str) { return 0; @@ -3049,14 +3098,22 @@ setTimeout: function setTimeout(callback, timeout) { return addTimer.call(this, arguments, false); }, clearTimeout: function clearTimeout(timerId) { + if (!timerId) { + // null appears to be allowed in most browsers, and appears to be relied upon by some libraries, like Bootstrap carousel + return; + } if (!this.timeouts) { this.timeouts = []; } - + // in Node, timerId is an object with .ref()/.unref(), and + // its .id field is the actual timer id. + if (typeof timerId === 'object') { + timerId = timerId.id + } if (timerId in this.timeouts) { delete this.timeouts[timerId]; } }, @@ -3439,11 +3496,11 @@ xhr.GlobalActiveXObject = global.ActiveXObject; xhr.supportsActiveX = typeof xhr.GlobalActiveXObject != "undefined"; xhr.supportsXHR = typeof xhr.GlobalXMLHttpRequest != "undefined"; xhr.workingXHR = xhr.supportsXHR ? xhr.GlobalXMLHttpRequest : xhr.supportsActiveX ? function() { return new xhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false; - xhr.supportsCORS = 'withCredentials' in (new sinon.xhr.GlobalXMLHttpRequest()); + xhr.supportsCORS = xhr.supportsXHR && 'withCredentials' in (new sinon.xhr.GlobalXMLHttpRequest()); /*jsl:ignore*/ var unsafeHeaders = { "Accept-Charset": true, "Accept-Encoding": true, @@ -3977,11 +4034,11 @@ return sinon.FakeXMLHttpRequest; }; sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; -})(typeof global === "object" ? global : this); +})((function(){ return typeof global === "object" ? global : this; })()); if (typeof module !== 'undefined' && module.exports) { module.exports = sinon; } @@ -4060,19 +4117,10 @@ } return false; } - function log(response, request) { - var str; - - str = "Request:\n" + sinon.format(request) + "\n\n"; - str += "Response:\n" + sinon.format(response) + "\n\n"; - - sinon.log(str); - } - return { create: function () { var server = create(this); this.xhr = sinon.useFakeXMLHttpRequest(); server.requests = []; @@ -4121,10 +4169,19 @@ } else { this.processRequest(xhr); } }, + log: function(response, request) { + var str; + + str = "Request:\n" + sinon.format(request) + "\n\n"; + str += "Response:\n" + sinon.format(response) + "\n\n"; + + sinon.log(str); + }, + respondWith: function respondWith(method, url, body) { if (arguments.length == 1 && typeof method != "function") { this.response = responseArray(method); return; } @@ -4150,11 +4207,11 @@ }, respond: function respond() { if (arguments.length > 0) this.respondWith.apply(this, arguments); var queue = this.queue || []; - var requests = queue.splice(0); + var requests = queue.splice(0, queue.length); var request; while(request = requests.shift()) { this.processRequest(request); } @@ -4176,11 +4233,11 @@ } } } if (request.readyState != 4) { - log(response, request); + sinon.fakeServer.log(response, request); request.respond(response[0], response[1], response[2]); } } catch (e) { sinon.logError("Fake server request processing", e); @@ -4296,11 +4353,11 @@ * @license BSD * * Copyright (c) 2010-2013 Christian Johansen */ -if (typeof module !== 'undefined' && module.exports) { +if (typeof module !== "undefined" && module.exports && typeof require == "function") { var sinon = require("../sinon"); sinon.extend(sinon, require("./util/fake_timers")); } (function () { @@ -4415,11 +4472,13 @@ } }); sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; - if (typeof module !== 'undefined' && module.exports) { + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = sinon.sandbox; }); + } else if (typeof module !== 'undefined' && module.exports) { module.exports = sinon.sandbox; } }()); /** @@ -4438,11 +4497,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } @@ -4455,11 +4514,11 @@ if (type != "function") { throw new TypeError("sinon.test needs to wrap a test function, got " + type); } - return function () { + function sinonSandboxedTest() { var config = sinon.getConfig(sinon.config); config.injectInto = config.injectIntoThis && this || config.injectInto; var sandbox = sinon.sandbox.create(config); var exception, result; var args = Array.prototype.slice.call(arguments).concat(sandbox.args); @@ -4478,24 +4537,34 @@ sandbox.verifyAndRestore(); } return result; }; + + if (callback.length) { + return function sinonAsyncSandboxedTest(callback) { + return sinonSandboxedTest.apply(this, arguments); + }; + } + + return sinonSandboxedTest; } test.config = { injectIntoThis: true, injectInto: null, properties: ["spy", "stub", "mock", "clock", "server", "requests"], useFakeTimers: true, useFakeServer: true }; - if (commonJSModule) { + sinon.test = test; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = test; }); + } else if (commonJSModule) { module.exports = test; - } else { - sinon.test = test; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -4511,11 +4580,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon) { - var commonJSModule = typeof module !== 'undefined' && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; if (!sinon && commonJSModule) { sinon = require("../sinon"); } @@ -4585,14 +4654,16 @@ } return methods; } - if (commonJSModule) { + sinon.testCase = testCase; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = testCase; }); + } else if (commonJSModule) { module.exports = testCase; - } else { - sinon.testCase = testCase; } }(typeof sinon == "object" && sinon || null)); /** * @depend ../sinon.js @@ -4608,11 +4679,11 @@ * * Copyright (c) 2010-2013 Christian Johansen */ (function (sinon, global) { - var commonJSModule = typeof module !== "undefined" && module.exports; + var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function"; var slice = Array.prototype.slice; var assert; if (!sinon && commonJSModule) { sinon = require("../sinon"); @@ -4782,13 +4853,221 @@ mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); mirrorPropAsAssertion("threw", "%n did not throw exception%C"); mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); - if (commonJSModule) { + sinon.assert = assert; + + if (typeof define === "function" && define.amd) { + define(["module"], function(module) { module.exports = assert; }); + } else if (commonJSModule) { module.exports = assert; - } else { - sinon.assert = assert; } }(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global)); + +/** + * @depend ../../sinon.js + * @depend event.js + */ +/*jslint eqeqeq: false, onevar: false*/ +/*global sinon, module, require, XDomainRequest*/ +/** + * Fake XDomainRequest object + */ + +if (typeof sinon == "undefined") { + this.sinon = {}; +} +sinon.xdr = { XDomainRequest: this.XDomainRequest }; + +// wrapper for global +(function (global) { + var xdr = sinon.xdr; + xdr.GlobalXDomainRequest = global.XDomainRequest; + xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined"; + xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false; + + function FakeXDomainRequest() { + this.readyState = FakeXDomainRequest.UNSENT; + this.requestBody = null; + this.requestHeaders = {}; + this.status = 0; + this.timeout = null; + + if (typeof FakeXDomainRequest.onCreate == "function") { + FakeXDomainRequest.onCreate(this); + } + } + + function verifyState(xdr) { + if (xdr.readyState !== FakeXDomainRequest.OPENED) { + throw new Error("INVALID_STATE_ERR"); + } + + if (xdr.sendFlag) { + throw new Error("INVALID_STATE_ERR"); + } + } + + function verifyRequestSent(xdr) { + if (xdr.readyState == FakeXDomainRequest.UNSENT) { + throw new Error("Request not sent"); + } + if (xdr.readyState == FakeXDomainRequest.DONE) { + throw new Error("Request done"); + } + } + + function verifyResponseBodyType(body) { + if (typeof body != "string") { + var error = new Error("Attempted to respond to fake XDomainRequest with " + + body + ", which is not a string."); + error.name = "InvalidBodyException"; + throw error; + } + } + + sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, { + open: function open(method, url) { + this.method = method; + this.url = url; + + this.responseText = null; + this.sendFlag = false; + + this.readyStateChange(FakeXDomainRequest.OPENED); + }, + + readyStateChange: function readyStateChange(state) { + this.readyState = state; + var eventName = ''; + switch (this.readyState) { + case FakeXDomainRequest.UNSENT: + break; + case FakeXDomainRequest.OPENED: + break; + case FakeXDomainRequest.LOADING: + if (this.sendFlag){ + //raise the progress event + eventName = 'onprogress'; + } + break; + case FakeXDomainRequest.DONE: + if (this.isTimeout){ + eventName = 'ontimeout' + } + else if (this.errorFlag || (this.status < 200 || this.status > 299)) { + eventName = 'onerror'; + } + else { + eventName = 'onload' + } + break; + } + + // raising event (if defined) + if (eventName) { + if (typeof this[eventName] == "function") { + try { + this[eventName](); + } catch (e) { + sinon.logError("Fake XHR " + eventName + " handler", e); + } + } + } + }, + + send: function send(data) { + verifyState(this); + + if (!/^(get|head)$/i.test(this.method)) { + this.requestBody = data; + } + this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; + + this.errorFlag = false; + this.sendFlag = true; + this.readyStateChange(FakeXDomainRequest.OPENED); + + if (typeof this.onSend == "function") { + this.onSend(this); + } + }, + + abort: function abort() { + this.aborted = true; + this.responseText = null; + this.errorFlag = true; + + if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) { + this.readyStateChange(sinon.FakeXDomainRequest.DONE); + this.sendFlag = false; + } + }, + + setResponseBody: function setResponseBody(body) { + verifyRequestSent(this); + verifyResponseBodyType(body); + + var chunkSize = this.chunkSize || 10; + var index = 0; + this.responseText = ""; + + do { + this.readyStateChange(FakeXDomainRequest.LOADING); + this.responseText += body.substring(index, index + chunkSize); + index += chunkSize; + } while (index < body.length); + + this.readyStateChange(FakeXDomainRequest.DONE); + }, + + respond: function respond(status, contentType, body) { + // content-type ignored, since XDomainRequest does not carry this + // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease + // test integration across browsers + this.status = typeof status == "number" ? status : 200; + this.setResponseBody(body || ""); + }, + + simulatetimeout: function(){ + this.status = 0; + this.isTimeout = true; + // Access to this should actually throw an error + this.responseText = undefined; + this.readyStateChange(FakeXDomainRequest.DONE); + } + }); + + sinon.extend(FakeXDomainRequest, { + UNSENT: 0, + OPENED: 1, + LOADING: 3, + DONE: 4 + }); + + sinon.useFakeXDomainRequest = function () { + sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) { + if (xdr.supportsXDR) { + global.XDomainRequest = xdr.GlobalXDomainRequest; + } + + delete sinon.FakeXDomainRequest.restore; + + if (keepOnCreate !== true) { + delete sinon.FakeXDomainRequest.onCreate; + } + }; + if (xdr.supportsXDR) { + global.XDomainRequest = sinon.FakeXDomainRequest; + } + return sinon.FakeXDomainRequest; + }; + + sinon.FakeXDomainRequest = FakeXDomainRequest; +})(this); + +if (typeof module == "object" && typeof require == "function") { + module.exports = sinon; +} return sinon;}.call(typeof window != 'undefined' && window || {}));