nextcloud/apps/files_sharing
Daniel Calviño Sánchez 26cf16d67f
Fix constructor spy in unit test with Sinon 4.1.3
When a constructor is spied using Sinon it is wrapped by a proxy
function, which calls the original constructor when invoked. When "new
Foo()" is executed a "Foo" object is created, "Foo" is invoked with the
object as "this", and the object is returned as the result of the whole
"new" expression.

Before Sinon 4.1.3 the proxy called the original constructor directly
using the "thisValue" of the spied call; "thisValue" was the object
created by the "new" operator that called the proxy. The proxy assigned
"thisValue" to "returnValue", so it was also the value returned by the
proxy and, in turn, the value returned by the whole "new" expression.

Since Sinon 4.1.3 (see pull request 1626) the proxy calls the original
constructor using "new" instead of directly. The "thisValue" created by
the outermost "new" (the one that called the proxy) is no longer used by
the original constructor; the internal "new" creates a new object, which
is the one passed to the original constructor and returned by the
internal "new" expression. This object is also the value returned by the
proxy ("returnValue") and, in turn, the value returned by the whole
outermost "new" expression.

Thus, now "returnValue" should be used instead of "thisValue" to get the
object created by the spied constructor.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-11 16:49:39 +01:00
..
ajax only use one kind of hack for the storage wrappers of the sharing code 2016-11-16 19:04:47 +01:00
appinfo Fix the share type of guest shares when migrating from ownCloud 2017-05-12 09:38:48 +02:00
css Fix working icon placement on password save 2017-04-24 11:50:06 +02:00
img Svgo optimization 2016-09-27 20:56:26 +02:00
js Do not iterate over the files 2017-08-27 18:37:44 +02:00
l10n [tx-robot] updated from transifex 2017-12-10 01:10:38 +00:00
lib delay calculating the shared cache root until it's used 2017-12-04 15:18:23 +01:00
templates Change id to class in the main share template 2017-08-14 22:24:00 +02:00
tests Fix constructor spy in unit test with Sinon 4.1.3 2017-12-11 16:49:39 +01:00
list.php Fix apps/ 2016-07-21 18:13:57 +02:00
public.php Fix apps/ 2016-07-21 18:13:57 +02:00