mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-01 00:29:39 +02:00
Do not block large media resources when loaded as top-level document
Related issues: - https://github.com/uBlockOrigin/uBlock-issues/issues/1201 - https://github.com/uBlockOrigin/uBlock-issues/issues/3184 Top-level media resources are not meant to be blocked, see: https://github.com/gorhill/uBlock/issues/2813#issuecomment-317177212
This commit is contained in:
parent
616c54f475
commit
3919a16bb8
@ -19,17 +19,13 @@
|
|||||||
Home: https://github.com/gorhill/uBlock
|
Home: https://github.com/gorhill/uBlock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
import contextMenu from './contextmenu.js';
|
import {
|
||||||
import logger from './logger.js';
|
domainFromHostname,
|
||||||
import staticNetFilteringEngine from './static-net-filtering.js';
|
hostnameFromURI,
|
||||||
import µb from './background.js';
|
isNetworkURI,
|
||||||
import webext from './webext.js';
|
} from './uri-utils.js';
|
||||||
import { orphanizeString } from './text-utils.js';
|
|
||||||
import { redirectEngine } from './redirect-engine.js';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sessionFirewall,
|
sessionFirewall,
|
||||||
@ -37,11 +33,13 @@ import {
|
|||||||
sessionURLFiltering,
|
sessionURLFiltering,
|
||||||
} from './filtering-engines.js';
|
} from './filtering-engines.js';
|
||||||
|
|
||||||
import {
|
import contextMenu from './contextmenu.js';
|
||||||
domainFromHostname,
|
import logger from './logger.js';
|
||||||
hostnameFromURI,
|
import { orphanizeString } from './text-utils.js';
|
||||||
isNetworkURI,
|
import { redirectEngine } from './redirect-engine.js';
|
||||||
} from './uri-utils.js';
|
import staticNetFilteringEngine from './static-net-filtering.js';
|
||||||
|
import webext from './webext.js';
|
||||||
|
import µb from './background.js';
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
@ -379,11 +377,13 @@ const PageStore = class {
|
|||||||
|
|
||||||
// If we are navigating from-to same site, remember whether large
|
// If we are navigating from-to same site, remember whether large
|
||||||
// media elements were temporarily allowed.
|
// media elements were temporarily allowed.
|
||||||
if (
|
const now = Date.now();
|
||||||
typeof this.allowLargeMediaElementsUntil !== 'number' ||
|
if ( typeof this.allowLargeMediaElementsUntil !== 'number' ) {
|
||||||
tabContext.rootHostname !== this.tabHostname
|
this.allowLargeMediaElementsUntil = now;
|
||||||
) {
|
} else if ( tabContext.rootHostname !== this.tabHostname ) {
|
||||||
this.allowLargeMediaElementsUntil = Date.now();
|
if ( this.tabHostname.endsWith('about-scheme') === false ) {
|
||||||
|
this.allowLargeMediaElementsUntil = now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabHostname = tabContext.rootHostname;
|
this.tabHostname = tabContext.rootHostname;
|
||||||
|
@ -590,7 +590,7 @@ const onHeadersReceived = function(details) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const reMediaContentTypes = /^(?:audio|image|video)\//;
|
const reMediaContentTypes = /^(?:audio|image|video)\/|(?:\/ogg)$/;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user