summaryrefslogtreecommitdiff
path: root/ext/bg/js/audio-downloader.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-12-18 17:06:30 -0500
committerGitHub <noreply@github.com>2020-12-18 17:06:30 -0500
commit05d4049f16715194842cf8cdf62345478288ee71 (patch)
treebd64ad1829e8da9f08dc968abddb6f6f8cad6d41 /ext/bg/js/audio-downloader.js
parent9beb659b178ab922a4d11a821ed6d2f1bce40f96 (diff)
DOMParser replacement (#561)
* Add script to build library files * Add built parse5 library * Add new SimpleDOMParser which uses parse5 * Update license info * Update MV3 build to use the new SimpleDOMParser * Update file exclusions * Hide/clarify license info for MV2 builds
Diffstat (limited to 'ext/bg/js/audio-downloader.js')
-rw-r--r--ext/bg/js/audio-downloader.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/bg/js/audio-downloader.js b/ext/bg/js/audio-downloader.js
index 839eab7b..d1c4a02e 100644
--- a/ext/bg/js/audio-downloader.js
+++ b/ext/bg/js/audio-downloader.js
@@ -17,6 +17,7 @@
/* global
* NativeSimpleDOMParser
+ * SimpleDOMParser
*/
class AudioDownloader {
@@ -239,8 +240,10 @@ class AudioDownloader {
}
_createSimpleDOMParser(content) {
- if (NativeSimpleDOMParser.isSupported()) {
+ if (typeof NativeSimpleDOMParser !== 'undefined' && NativeSimpleDOMParser.isSupported()) {
return new NativeSimpleDOMParser(content);
+ } else if (typeof SimpleDOMParser !== 'undefined' && SimpleDOMParser.isSupported()) {
+ return new SimpleDOMParser(content);
} else {
throw new Error('DOM parsing not supported');
}