Don't attempt to run regular expressions on very long URIs (fixes incompatibility with Update Scanner as reported at http://forums.zotero.org/discussion/17604/216-translator-hangs-with-addon-update-scanner/#Item_0)

This commit is contained in:
Simon Kornblith 2011-04-18 23:23:41 +00:00
parent a6727940f4
commit 0a3b96bd9c

View file

@ -991,8 +991,9 @@ Zotero.Translate.Web.prototype._getPotentialTranslators = function() {
var allTranslators = Zotero.Translators.getAllForType("web"); var allTranslators = Zotero.Translators.getAllForType("web");
var potentialTranslators = []; var potentialTranslators = [];
Zotero.debug("Translate: Running regular expressions");
for(var i=0; i<allTranslators.length; i++) { for(var i=0; i<allTranslators.length; i++) {
if(!allTranslators[i].webRegexp || allTranslators[i].webRegexp.test(this.location)) { if(!allTranslators[i].webRegexp || (this.location.length < 8192 && allTranslators[i].webRegexp.test(this.location))) {
potentialTranslators.push(allTranslators[i]); potentialTranslators.push(allTranslators[i]);
} }
} }