Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
minor performance tweaks to Config.getMatchingScripts()
  • Loading branch information
erikvold committed Jun 26, 2011
1 parent 6e98e08 commit 3b7e9ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extension/modules/config/config.js
Expand Up @@ -427,9 +427,12 @@ Config.prototype = {

get scripts() this._scripts.concat(),
getMatchingScripts: function(testFunc, urls) {
for (var i = 0; i < urls.length; i++)
if (this._excludeRegExps.some(function(reg) reg.test(urls[i])))
var globalExcludes = this._excludeRegExps;
for (var i = urls.length - 1; ~i; i--) {
let url = urls[i];
if (globalExcludes.some(function(reg) reg.test(url)))
return [];
}
return this.scripts.filter(testFunc);
},
sortScripts: function() this._scripts.sort(function(a, b) b.priority - a.priority),
Expand Down

0 comments on commit 3b7e9ea

Please sign in to comment.