Improved blocking of media documents unaffected by webRequest.
This commit is contained in:
parent
fd51f8ffc1
commit
95d64c42d0
|
@ -1,6 +1,24 @@
|
||||||
if (ns.embeddingDocument) {
|
if (ns.embeddingDocument) {
|
||||||
|
let suspended;
|
||||||
|
let suspender = new MutationObserver(records => {
|
||||||
|
suspended = document.body.firstElementChild;
|
||||||
|
if (suspended && !suspended._src) {
|
||||||
|
suspended._src = suspended.currentSrc || document.URL;
|
||||||
|
debug("Suspending ", suspended._src, suspended);
|
||||||
|
suspended.autoplay = false;
|
||||||
|
suspended.src = "data:";
|
||||||
|
suspender.disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
suspender.observe(document, {childList: true, subtree: true});
|
||||||
|
|
||||||
let replace = () => {
|
let replace = () => {
|
||||||
|
if (suspended) {
|
||||||
|
suspended.src = suspended._src;
|
||||||
|
suspended.autoplay = true;
|
||||||
|
} else {
|
||||||
|
suspender.disconnect();
|
||||||
|
}
|
||||||
for (let policyType of ["object", "media"]) {
|
for (let policyType of ["object", "media"]) {
|
||||||
let request = {
|
let request = {
|
||||||
id: `noscript-${policyType}-doc`,
|
id: `noscript-${policyType}-doc`,
|
||||||
|
|
Loading…
Reference in New Issue