This commit is contained in:
gorhill 2016-12-21 11:44:03 -05:00
parent 0b8f27801c
commit 2f01fcda54
2 changed files with 17 additions and 3 deletions

View File

@ -510,6 +510,20 @@ if ( self.injectCSS ) {
/******************************************************************************/ /******************************************************************************/
// https://bugzilla.mozilla.org/show_bug.cgi?id=444165
// https://github.com/gorhill/uBlock/issues/2256
// Not the prettiest solution, but that's the safest/simplest I can think
// of at this point. If/when bugzilla issue above is solved, we will need
// version detection to decide whether the patch needs to be applied.
vAPI.iframeLoadEventPatch = function(target) {
if ( target.localName === 'iframe' ) {
target.dispatchEvent(new Event('load'));
}
};
/******************************************************************************/
// No need to have vAPI client linger around after shutdown if // No need to have vAPI client linger around after shutdown if
// we are not a top window (because element picker can still // we are not a top window (because element picker can still
// be injected in top window). // be injected in top window).

View File

@ -947,6 +947,8 @@ vAPI.domCollapser = (function() {
netSelectorCacheCountMax = response.netSelectorCacheCountMax, netSelectorCacheCountMax = response.netSelectorCacheCountMax,
aa = [ null ], aa = [ null ],
request, key, entry, target, value; request, key, entry, target, value;
// https://github.com/gorhill/uBlock/issues/2256
var iframeLoadEventPatch = vAPI.iframeLoadEventPatch;
// Important: process in chronological order -- this ensures the // Important: process in chronological order -- this ensures the
// cached selectors are the most useful ones. // cached selectors are the most useful ones.
for ( var i = 0, ni = requests.length; i < ni; i++ ) { for ( var i = 0, ni = requests.length; i < ni; i++ ) {
@ -980,6 +982,7 @@ vAPI.domCollapser = (function() {
selectors.push(request.tag + '[' + request.attr + '="' + value + '"]'); selectors.push(request.tag + '[' + request.attr + '="' + value + '"]');
netSelectorCacheCount += 1; netSelectorCacheCount += 1;
} }
if ( iframeLoadEventPatch ) { iframeLoadEventPatch(target); }
} }
} }
if ( selectors.length !== 0 ) { if ( selectors.length !== 0 ) {
@ -1030,9 +1033,6 @@ vAPI.domCollapser = (function() {
} }
}; };
// If needed eventually, we could listen to `src` attribute changes
// for iframes.
var add = function(target) { var add = function(target) {
var tag = target.localName; var tag = target.localName;
var prop = src1stProps[tag]; var prop = src1stProps[tag];