chrome.downloads.search异步调用上出现奇怪的xmlParseEntityRef错误

时间:2014-10-06 14:54:24

标签: javascript google-chrome asynchronous google-chrome-extension

所以基本上我使用async js async.parallel([processQuery],function(r){})来调用这个函数; 但由于某种原因,当我查询的字符很长时,我得到一个错误 -

Error: error on line 1 at column 72: xmlParseEntityRef: no name

    at downloadPlugin.processQuery (chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/search-engine/downloads.js:4:20)
    at chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:570:21
    at chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:249:17
    at replenish (chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:194:21)
    at chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:206:33
    at chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:251:21
    at chrome-extension://eciaeefgndhpejknefmbegjdlkkihbkb/scripts/external/async.js:575:34

-

var processQuery = function(cb){
            chrome.downloads.search({query:[currentQuery], limit:5, state:'complete',orderBy:['-startTime']}, function(results){
                var formattedResults = [];
                for(var i in results){
                    if(results[i].url == undefined)
                        continue;
                    new function(downloadId, downloadTitle){


    formattedResults.push({
                            launch: function(){
                                chrome.downloads.show(downloadId);
                            },
                            description: 'kaka'
                        });
                    }(results[i].id, results[i].filename);
                }
                console.log(formattedResults);
                cb(null, {name:'Downlaods',results:formattedResults});

            });

        }

0 个答案:

没有答案