summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/api.js2
-rw-r--r--ext/bg/js/audio.js18
2 files changed, 7 insertions, 13 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 94a70c34..9fefadca 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -176,7 +176,7 @@ apiCommandExec.handlers = {
};
async function apiAudioGetUrl(definition, source, optionsContext) {
- return audioBuildUrl(definition, source, optionsContext);
+ return audioGetUrl(definition, source, optionsContext);
}
async function apiInjectScreenshot(definition, fields, screenshot) {
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 1a626d42..9508abf0 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -93,20 +93,14 @@ const audioUrlBuilders = {
}
};
-async function audioBuildUrl(definition, mode, optionsContext, cache={}) {
- const cacheKey = `${mode}:${definition.expression}`;
- if (cache.hasOwnProperty(cacheKey)) {
- return Promise.resolve(cache[cacheKey]);
- }
-
+async function audioGetUrl(definition, mode, optionsContext, download) {
if (audioUrlBuilders.hasOwnProperty(mode)) {
const handler = audioUrlBuilders[mode];
- return handler(definition, optionsContext).then(
- (url) => {
- cache[cacheKey] = url;
- return url;
- },
- () => null);
+ try {
+ return await handler(definition, optionsContext, download);
+ } catch (e) {
+ // NOP
+ }
}
return null;
}