Backport SinonJS bugfix for broken splice() in IE8 and es5-shim
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 10 Jul 2014 13:36:30 +0000 (15:36 +0200)
committerKrinkle <krinklemail@gmail.com>
Thu, 10 Jul 2014 13:37:13 +0000 (13:37 +0000)
SinonJS 1.9.1 made use of a rare feature in Array#splice that is
implemented in most browsers but not actually part of the ES5 spec.

And in IE8 and es5-shimmed environments, the method was 'broken'
and thus always yielded an empty array causing none of the XHRs
to be responded to.

We can't upgrade to SinonJS 1.10 right now due to
https://github.com/cjohansen/Sinon.JS/issues/506.

Patch source:
 https://github.com/cjohansen/Sinon.JS/commit/60ab124d21

Change-Id: I8882198b1609cb78f16a8269d40bb19df2df127a

resources/lib/sinonjs/sinon-1.9.0.js

index 428b729..574e617 100644 (file)
@@ -4152,7 +4152,7 @@ sinon.fakeServer = (function () {
         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()) {