diff --git a/storage.js b/storage.js index 102d2935..5389cd36 100644 --- a/storage.js +++ b/storage.js @@ -82,7 +82,7 @@ function getStyles(options, callback) { } // now add in global ones getGlobalStyleIds(function(ids) { - style_ids = style_ids.concat(ids); + style_ids = uniqueArray(style_ids.concat(ids)); loadStyles(style_ids, options.enabled, options.url, callback); }); }); @@ -93,6 +93,12 @@ function getStyles(options, callback) { }, reportError); } +function uniqueArray(ar) { + return ar.filter(function(s, i, a){ + return i === a.lastIndexOf(s); + }); +} + function getCache(callback) { if (isBackground()) { callback(cachedStyles);