From 9502679982e12f2b71f1462652ed7a184913916a Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 23 Jul 2014 12:54:22 -0400 Subject: [PATCH] this fixes #381 --- js/assets.js | 17 +++++++++++------ manifest.json | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/js/assets.js b/js/assets.js index 1267ad9..aa10b91 100644 --- a/js/assets.js +++ b/js/assets.js @@ -78,13 +78,18 @@ var cachedAssetsManager = (function() { return; } var onLoaded = function(bin) { - if ( chrome.runtime.lastError ) { - console.error( - 'HTTP Switchboard> cachedAssetsManager> getEntries():', - chrome.runtime.lastError.message - ); + // https://github.com/gorhill/httpswitchboard/issues/381 + // Maybe the index was requested multiple times and already + // fetched by one of the occurrences. + if ( entries === null ) { + if ( chrome.runtime.lastError ) { + console.error( + 'HTTP Switchboard> cachedAssetsManager> getEntries():', + chrome.runtime.lastError.message + ); + } + entries = bin.cached_asset_entries || {}; } - entries = bin.cached_asset_entries || {}; callback(entries); }; chrome.storage.local.get('cached_asset_entries', onLoaded); diff --git a/manifest.json b/manifest.json index 29552be..8f0c372 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extName__", "short_name": "HTTPSB", - "version": "1.0.0.3", + "version": "1.0.0.4", "description": "__MSG_extShortDesc__", "icons": { "16": "icon_16.png",