From 9e792f4e266a8d195bc937ec3f120c693e91064d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 7 Jul 2015 10:28:16 +0100 Subject: [PATCH] Update Sinon.JS to 1.15.4 * Code http://sinonjs.org/releases/sinon-1.15.4.js http://sinonjs.org/releases/sinon-ie-1.15.4.js * Change log http://sinonjs.org/Changelog.txt https://github.com/cjohansen/Sinon.JS/commits/v1.15.4 Mainly: * Support XHR.responseType 'json'. * Remove deprecation warnings from sinon.mock(). Change-Id: I4e0d8f044eb2841ab361b1efc76fb36797f15e42 --- RELEASE-NOTES-1.26 | 2 +- .../{sinon-1.15.0.js => sinon-1.15.4.js} | 18 ++++++++++++++---- .../{sinon-ie-1.15.0.js => sinon-ie-1.15.4.js} | 2 +- tests/qunit/QUnitTestResources.php | 4 ++-- 4 files changed, 18 insertions(+), 8 deletions(-) rename resources/lib/sinonjs/{sinon-1.15.0.js => sinon-1.15.4.js} (99%) rename resources/lib/sinonjs/{sinon-ie-1.15.0.js => sinon-ie-1.15.4.js} (99%) diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index e5199b450b..81269b8608 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -45,7 +45,7 @@ production. ==== External libraries ==== * Update es5-shim from v4.0.0 to v4.1.5. * Update json2 from revision 2014-02-04 to 2015-05-03. -* Update Sinon.JS from 1.10.3 to 1.15.0. +* Update Sinon.JS from 1.10.3 to 1.15.4. * Upgrade jQuery Client from v1.0.0 to v2.0.0. * Added mediawiki/at-ease 1.0.0. * Update QUnit from v1.17.1 to v1.18.0. diff --git a/resources/lib/sinonjs/sinon-1.15.0.js b/resources/lib/sinonjs/sinon-1.15.4.js similarity index 99% rename from resources/lib/sinonjs/sinon-1.15.0.js rename to resources/lib/sinonjs/sinon-1.15.4.js index 8add41d405..20bc9e208d 100644 --- a/resources/lib/sinonjs/sinon-1.15.0.js +++ b/resources/lib/sinonjs/sinon-1.15.4.js @@ -1,5 +1,5 @@ /** - * Sinon.JS 1.15.0, 2015/05/30 + * Sinon.JS 1.15.4, 2015/06/27 * * @author Christian Johansen (christian@cjohansen.no) * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS @@ -3312,9 +3312,9 @@ var sinon = (function () { var match = sinon.match; function mock(object) { - if (typeof console !== undefined && console.warn) { - console.warn("mock will be removed from Sinon.JS v2.0"); - } + // if (typeof console !== undefined && console.warn) { + // console.warn("mock will be removed from Sinon.JS v2.0"); + // } if (!object) { return sinon.expectation.create("Anonymous mock"); @@ -4447,6 +4447,10 @@ if (typeof sinon == "undefined") { }; /*jsl:end*/ + // Note that for FakeXMLHttpRequest to work pre ES5 + // we lose some of the alignment with the spec. + // To ensure as close a match as possible, + // set responseType before calling open, send or respond; function FakeXMLHttpRequest() { this.readyState = FakeXMLHttpRequest.UNSENT; this.requestHeaders = {}; @@ -4454,6 +4458,8 @@ if (typeof sinon == "undefined") { this.status = 0; this.statusText = ""; this.upload = new UploadProgress(); + this.responseType = ""; + this.response = ""; if (sinonXhr.supportsCORS) { this.withCredentials = false; } @@ -4735,6 +4741,7 @@ if (typeof sinon == "undefined") { this.username = username; this.password = password; this.responseText = null; + this.response = this.responseType === "json" ? null : ""; this.responseXML = null; this.requestHeaders = {}; this.sendFlag = false; @@ -4827,6 +4834,7 @@ if (typeof sinon == "undefined") { this.errorFlag = false; this.sendFlag = this.async; + this.response = this.responseType === "json" ? null : ""; this.readyStateChange(FakeXMLHttpRequest.OPENED); if (typeof this.onSend == "function") { @@ -4839,6 +4847,7 @@ if (typeof sinon == "undefined") { abort: function abort() { this.aborted = true; this.responseText = null; + this.response = this.responseType === "json" ? null : ""; this.errorFlag = true; this.requestHeaders = {}; this.responseHeaders = {}; @@ -4919,6 +4928,7 @@ if (typeof sinon == "undefined") { } } + this.response = this.responseType === "json" ? JSON.parse(this.responseText) : this.responseText; this.readyStateChange(FakeXMLHttpRequest.DONE); }, diff --git a/resources/lib/sinonjs/sinon-ie-1.15.0.js b/resources/lib/sinonjs/sinon-ie-1.15.4.js similarity index 99% rename from resources/lib/sinonjs/sinon-ie-1.15.0.js rename to resources/lib/sinonjs/sinon-ie-1.15.4.js index 2756321f6c..9eac9580a2 100644 --- a/resources/lib/sinonjs/sinon-ie-1.15.0.js +++ b/resources/lib/sinonjs/sinon-ie-1.15.4.js @@ -1,5 +1,5 @@ /** - * Sinon.JS 1.15.0, 2015/05/30 + * Sinon.JS 1.15.4, 2015/06/27 * * @author Christian Johansen (christian@cjohansen.no) * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS diff --git a/tests/qunit/QUnitTestResources.php b/tests/qunit/QUnitTestResources.php index c6f3a2311a..97eddeefaf 100644 --- a/tests/qunit/QUnitTestResources.php +++ b/tests/qunit/QUnitTestResources.php @@ -8,14 +8,14 @@ return array( 'test.sinonjs' => array( 'scripts' => array( - 'resources/lib/sinonjs/sinon-1.15.0.js', + 'resources/lib/sinonjs/sinon-1.15.4.js', // We want tests to work in IE, but can't include this as it // will break the placeholders in Sinon because the hack it uses // to hijack IE globals relies on running in the global scope // and in ResourceLoader this won't be running in the global scope. // Including it results (among other things) in sandboxed timers // being broken due to Date inheritance being undefined. - // 'resources/lib/sinonjs/sinon-ie-1.15.0.js', + // 'resources/lib/sinonjs/sinon-ie-1.15.4.js', ), 'targets' => array( 'desktop', 'mobile' ), ), -- 2.20.1