From 09354ce7e2ea471f9633a9d722f2b2a860ad3db9 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 1 May 2015 19:11:36 -0400 Subject: [PATCH 1/3] this fixes https://github.com/gorhill/uBlock/issues/162 --- src/js/contentscript-end.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js index db1af9cb8..127d76bd1 100644 --- a/src/js/contentscript-end.js +++ b/src/js/contentscript-end.js @@ -246,9 +246,27 @@ var uBlockCollapser = (function() { newRequests.push(new BouncingRequest(req.id, tagName, src)); }; - var addIFrame = function(iframe) { + var iframeSourceModified = function(mutations) { + var i = mutations.length; + while ( i-- ) { + addIFrame(mutations[i].target, true); + } + process(); + }; + var iframeSourceObserver = new MutationObserver(iframeSourceModified); + var iframeSourceObserverOptions = { + attributes: true, + attributeFilter: [ 'src' ] + }; + + var addIFrame = function(iframe, dontObserve) { + // https://github.com/gorhill/uBlock/issues/162 + // Be prepared to deal with possible change of src attribute. + if ( dontObserve !== true ) { + iframeSourceObserver.observe(iframe, iframeSourceObserverOptions); + } + var src = iframe.src; - // TODO: niject content script in `about:blank` as well. if ( src === '' || typeof src !== 'string' ) { return; } From a01113a1e7feeb29fd64bd00cae2bda95f8aa598 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 1 May 2015 19:12:20 -0400 Subject: [PATCH 2/3] removed dead code --- src/js/3p-filters.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/js/3p-filters.js b/src/js/3p-filters.js index 8169b9d54..955118ac4 100644 --- a/src/js/3p-filters.js +++ b/src/js/3p-filters.js @@ -422,12 +422,8 @@ var buttonApplyHandler = function() { renderBusyOverlay(true); - var onReloadDone = function() { - messager.send({ what: 'reloadAllFilters' }); - }; - var onSelectionDone = function() { - messager.send({ what: 'reloadAllFilters' }, onReloadDone); + messager.send({ what: 'reloadAllFilters' }); }; selectFilterLists(onSelectionDone); From ffdd3dfe636a27b7642ed95ef3ecec2976332afc Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 4 May 2015 17:14:56 -0400 Subject: [PATCH 3/3] this fixes https://github.com/gorhill/uBlock/issues/171 --- src/js/pagestore.js | 4 ++-- src/js/ublock.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/js/pagestore.js b/src/js/pagestore.js index 59b934e03..fc6d8caf0 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -20,7 +20,7 @@ */ /* jshint bitwise: false */ -/* global vAPI, µBlock */ +/* global µBlock */ /******************************************************************************* @@ -438,7 +438,7 @@ PageStore.prototype.getNetFilteringSwitch = function() { // https://github.com/chrisaljoudi/uBlock/issues/1078 // Use both the raw and normalized URLs. this.netFiltering = µb.getNetFilteringSwitch(tabContext.normalURL); - if ( this.netFiltering && tabContext.rawURL !== tabContext.pageURL ) { + if ( this.netFiltering && tabContext.rawURL !== tabContext.normalURL ) { this.netFiltering = µb.getNetFilteringSwitch(tabContext.rawURL); } this.netFilteringReadTime = Date.now(); diff --git a/src/js/ublock.js b/src/js/ublock.js index b713df96d..dff9fd966 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -180,6 +180,12 @@ var matchWhitelistDirective = function(url, hostname, directive) { var line, matches, key, directive; for ( var i = 0; i < lines.length; i++ ) { line = lines[i].trim(); + // https://github.com/gorhill/uBlock/issues/171 + // Skip empty lines + if ( line === '' ) { + continue; + } + // Don't throw out commented out lines: user might want to fix them if ( line.charAt(0) === '#' ) { key = '#'; @@ -208,9 +214,14 @@ var matchWhitelistDirective = function(url, hostname, directive) { } } + // https://github.com/gorhill/uBlock/issues/171 + // Skip empty keys + if ( key === '' ) { + continue; + } + // Be sure this stays fixed: // https://github.com/chrisaljoudi/uBlock/issues/185 - if ( whitelist.hasOwnProperty(key) === false ) { whitelist[key] = []; }