Browse Source

show placeholder for blocked `frame` elements (fix https://github.com/uBlockOrigin/uMatrix-issues/issues/120) (#1010)

pull/2/head
xofe 6 years ago
committed by Raymond Hill
parent
commit
26aedcc5f9
  1. 9
      src/js/contentscript.js

9
src/js/contentscript.js

@ -124,6 +124,7 @@ var collapser = (function() {
reURLPlaceholder = /\{\{url\}\}/g; reURLPlaceholder = /\{\{url\}\}/g;
var src1stProps = { var src1stProps = {
'embed': 'src', 'embed': 'src',
'frame': 'src',
'iframe': 'src', 'iframe': 'src',
'img': 'src', 'img': 'src',
'object': 'data' 'object': 'data'
@ -133,6 +134,7 @@ var collapser = (function() {
}; };
var tagToTypeMap = { var tagToTypeMap = {
embed: 'media', embed: 'media',
frame: 'frame',
iframe: 'frame', iframe: 'frame',
img: 'image', img: 'image',
object: 'media' object: 'media'
@ -187,6 +189,7 @@ var collapser = (function() {
continue; continue;
} }
switch ( tag ) { switch ( tag ) {
case 'frame':
case 'iframe': case 'iframe':
if ( placeholders.frame !== true ) { break; } if ( placeholders.frame !== true ) { break; }
let docurl = let docurl =
@ -321,11 +324,11 @@ var collapser = (function() {
while ( i-- ) { while ( i-- ) {
node = nodeList[i]; node = nodeList[i];
if ( node.nodeType !== 1 ) { continue; } if ( node.nodeType !== 1 ) { continue; }
if ( node.localName === 'iframe' ) {
if ( node.localName === 'iframe' || node.localName === 'frame' ) {
addIFrame(node); addIFrame(node);
} }
if ( node.childElementCount !== 0 ) { if ( node.childElementCount !== 0 ) {
addIFrames(node.querySelectorAll('iframe'));
addIFrames(node.querySelectorAll('iframe, frame'));
} }
} }
}; };
@ -456,7 +459,7 @@ var collapser = (function() {
} }
collapser.addMany(document.querySelectorAll('img')); collapser.addMany(document.querySelectorAll('img'));
collapser.addIFrames(document.querySelectorAll('iframe'));
collapser.addIFrames(document.querySelectorAll('iframe, frame'));
collapser.process(); collapser.process();
})(); })();

Loading…
Cancel
Save