Skip to content

Loading…

Fix for https://github.com/gorhill/uBlock/issues/162, https://github.com/gorhill/uBlock/issues/171 #1348

Merged
merged 3 commits into from

2 participants

@gorhill

No description provided.

@gorhill gorhill changed the title from Fix for https://github.com/gorhill/uBlock/issues/162 to Fix for https://github.com/gorhill/uBlock/issues/162, https://github.com/gorhill/uBlock/issues/171
@chrisaljoudi chrisaljoudi merged commit b380c91 into chrisaljoudi:master

1 check passed

Details continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 1, 2015
  1. @gorhill

    this fixes #162

    gorhill committed
  2. @gorhill

    removed dead code

    gorhill committed
Commits on May 4, 2015
  1. @gorhill

    this fixes #171

    gorhill committed
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 10 deletions.
  1. +1 −5 src/js/3p-filters.js
  2. +20 −2 src/js/contentscript-end.js
  3. +2 −2 src/js/pagestore.js
  4. +12 −1 src/js/ublock.js
View
6 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);
View
22 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;
}
View
4 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();
View
13 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] = [];
}
Something went wrong with that request. Please try again.