diff options
author | hackademix | 2019-07-21 02:25:54 +0200 |
---|---|---|
committer | hackademix | 2019-07-23 18:11:14 +0200 |
commit | c7f053a622a6f8b783dafa3de9a34ffb31bb5e41 (patch) | |
tree | 8445ea87b4b8cee7c719fc632922bbc859f42e73 /src | |
parent | 22393ac858b3717050839e42bc2d61494b7875cc (diff) | |
download | noscript-c7f053a622a6f8b783dafa3de9a34ffb31bb5e41.tar.gz noscript-c7f053a622a6f8b783dafa3de9a34ffb31bb5e41.tar.xz noscript-c7f053a622a6f8b783dafa3de9a34ffb31bb5e41.zip |
Handle corner case when application/* content types should match "media" rather than "object".
Diffstat (limited to 'src')
-rw-r--r-- | src/content/embeddingDocument.js | 11 |
1 files changed, 7 insertions, 4 deletions
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(); } |