From c7f053a622a6f8b783dafa3de9a34ffb31bb5e41 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sun, 21 Jul 2019 02:25:54 +0200 Subject: Handle corner case when application/* content types should match "media" rather than "object". --- src/content/embeddingDocument.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/content/embeddingDocument.js') diff --git a/src/content/embeddingDocument.js b/src/content/embeddingDocument.js index bc1b97f..d565fc5 100644 --- a/src/content/embeddingDocument.js +++ b/src/content/embeddingDocument.js @@ -27,16 +27,19 @@ if (ns.embeddingDocument) { if (!document.body.firstChild) { // we've been called early setTimeout(replace, 0); let types = { - "media": /^(?:video|audio)\//i, + // Reminder: order is important because media matches also for + // some /^application\// types + "media": /^(?:(?:video|audio)\/|application\/(?:ogg|mp4|mpeg)$)/i, "object": /^application\//i, } for (let [type, rx] of Object.entries(types)) { - if (rx.test(document.contentType) && !ns.allows(type)) { - window.stop(); + if (rx.test(document.contentType)) { + if (!ns.allows(type)) { + window.stop(); + } break; } } - } else { replace(); } -- cgit v1.2.3