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.
This commit is contained in:
parent
e459020b66
commit
55f044f87a
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue