commit 55f044f87a79b73a99873f4fd761cd9ff50836d0
parent e459020b6604518b88ac8a786e66fb2cadb7c1b6
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 28 Mar 2013 19:13:02 -0400
Disable send() method in Q promise for Mozilla Task.jsm compatibility
Task.jsm allows not only generators but also iterators to be yielded,
using ``typeof yielded == 'Function'`` as the test for an iterator, but
since the Q promise includes a send() method, yielding a Q promise
instead of a Mozilla promise results in an infinite loop. To fix this,
we disable Q's send() method, which is just an outdated synonym for
invoke() anyway.
This will have to be done every time we update Q until send() is
removed, Task.jsm is changed, or we stop using Task.jsm with Q promises.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/resource/q.js b/resource/q.js
@@ -602,7 +602,9 @@ array_reduce(
"dispatch",
"when", "spread",
"get", "put", "set", "del", "delete",
- "post", "send", "invoke",
+ // .send() disabled by Zotero for Mozilla Task.jsm compatibility
+ //"post", "send", "invoke",
+ "post", "invoke",
"keys",
"fapply", "fcall", "fbind",
"all", "allResolved",
@@ -1146,7 +1148,8 @@ var post = Q.post = dispatcher("post");
* @param ...args array of invocation arguments
* @return promise for the return value
*/
-Q.send = send;
+// Disabled by Zotero for Mozilla Task.jsm compatibility
+//Q.send = send;
Q.invoke = send; // synonyms
function send(value, name) {
var args = array_slice(arguments, 2);