diff --git a/assets/checksums.txt b/assets/checksums.txt index 94f4daeaa..6e02fcdce 100644 --- a/assets/checksums.txt +++ b/assets/checksums.txt @@ -1,11 +1,11 @@ 4d0e777a82576a2ec771742abb91925b assets/ublock/unbreak.txt 62111a29f0a5cb361ba8dbae92054adb assets/ublock/redirect-resources.txt 6c077d6d5b39e8a5a407966ad62c9c32 assets/ublock/privacy.txt -9bcc718383fec8b2ce0f9c379f45da9a assets/ublock/filters.txt +527f9f064f164a3445801d39caff3c6b assets/ublock/filters.txt 146704ad1c0393e342afdb416762c183 assets/ublock/badware.txt 5baa90e2da7cd6a73edff2010557ee57 assets/ublock/redirect.txt -b5e3ffc73ffce5c671b1eb9edd466241 assets/ublock/experimental.txt -62111a29f0a5cb361ba8dbae92054adb assets/ublock/resources.txt +d6f734c851d5077bd545d0fa39e8bb8d assets/ublock/experimental.txt +2f7339c072133f487c25f90d4da0632a assets/ublock/resources.txt 6c9d89c5dc6db345de36c8c966fff575 assets/ublock/filter-lists.json 50573388b525ede1a920cd4b4ee7fbf0 assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt 61cc16cf02e034370f0f47bc17c46551 assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt diff --git a/assets/ublock/experimental.txt b/assets/ublock/experimental.txt index aeb20879a..14d154099 100644 --- a/assets/ublock/experimental.txt +++ b/assets/ublock/experimental.txt @@ -16,8 +16,3 @@ # Replacement for `www.google-analytics.com/ga.js`: the goal is to be able to # block `www.google-analytics.com` while preventing web page breakage. ||www.google-analytics.com/ga.js$script,redirect=www.google-analytics.com/ga.js,important - - -# https://github.com/gorhill/uBlock/issues/1100 -# This will be moved to mainstream filter list once 1.5.0 lands. -1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,runnersworld.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:inject(uabinject-defuser.js) diff --git a/assets/ublock/filters.txt b/assets/ublock/filters.txt index f33f9f77a..1f529bd7f 100644 --- a/assets/ublock/filters.txt +++ b/assets/ublock/filters.txt @@ -165,7 +165,6 @@ investopedia.com##.pg-wrapper > div:not(#Nav):not(.nav-space):not(.subnav-space) # Useful inline script tag filters until filter list maintainers start to use # it in their respective filter lists arstechnica.com##script:contains(ars.READY.push) -1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:contains(uabInject) aussenwirtschaftslupe.de,autozeitung.de,brieffreunde.de,donnerwetter.de,formel1.de,fremdwort.de,helles-koepfchen.de,inside-handy.de,motorsport-total.com,moviejones.de,news.de,rechtslupe.de,wintotal.de##script:contains(window.tisoomi) bild.de##script:contains(/^\s*de.bild.cmsKonfig/) bild.de##script:contains(Javascript) @@ -234,7 +233,17 @@ skystreaming.net###fanback + style + div[id] ||c8factor.com^ ||k5zoom.com^ +# https://github.com/gorhill/uBlock/issues/1100 +# AdDefend +1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,runnersworld.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:inject(uabinject-defuser.js) + # Yavli ads +activistpost.com,alfonzorachel.com,aplus.com,breathecast.com,bulletsfirst.net,clashdaily.com,comicallyincorrect.com,conservativebyte.com,cowboybyte.com,dailysurge.com,dccrimestories.com,drhotze.com,explosm.net,genfringe.com,girlsjustwannahaveguns.com,joeforamerica.com,latinpost.com,mensfitness.com,minutemennews.com,mobilelikez.com,muscleandfitness.com,naturalblaze.com,oddee.com,okmagazine.com,patriotoutdoornews.com,pitgrit.com,radaronline.com,redmaryland.com,segmentnext.com,shark-tank.com,theblacksphere.net,thegatewaypundit.com,themattwalshblog.com,thepoke.co.uk,unilad.co.uk,valuewalk.com,vcpost.com,victoriajackson.com,viralnova.com##script:inject(yavli-defuser.js) + +# The following filters will be removed once 1.5.0 is widespread +# AdDefend +1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:contains(uabInject) +# Yavli activistpost.com,alfonzorachel.com,aplus.com,breathecast.com,bulletsfirst.net,clashdaily.com,comicallyincorrect.com,conservativebyte.com,cowboybyte.com,dailysurge.com,dccrimestories.com,drhotze.com,explosm.net,genfringe.com,girlsjustwannahaveguns.com,joeforamerica.com,latinpost.com,mensfitness.com,minutemennews.com,mobilelikez.com,muscleandfitness.com,naturalblaze.com,oddee.com,okmagazine.com,patriotoutdoornews.com,pitgrit.com,radaronline.com,redmaryland.com,segmentnext.com,shark-tank.com,theblacksphere.net,thegatewaypundit.com,themattwalshblog.com,thepoke.co.uk,unilad.co.uk,valuewalk.com,vcpost.com,victoriajackson.com,viralnova.com##script:contains(/^.{0,16}__durl=/) ||a.postrelease.com/serve/load.js$script,redirect=yavli-defuser.js,domain=mensfitness.com|okmagazine.com|radaronline.com ||ads.intergi.com^$script,redirect=yavli-defuser.js,domain=segmentnext.com diff --git a/assets/ublock/resources.txt b/assets/ublock/resources.txt index 93a5b3cf0..9644b2eea 100644 --- a/assets/ublock/resources.txt +++ b/assets/ublock/resources.txt @@ -200,31 +200,18 @@ i.ligatus.com/*/angular-tag.js application/javascript # script is normally blocked on the site. yavli-defuser.js application/javascript (function() { + var descriptor = { + set: function() { + ; + }, + get: function() { + return ''; + } + }; try { - Object.defineProperty(window, '__durl', { - set: function() { - ; - }, - get: function() { - return ''; - } - }); - Object.defineProperty(window, '__lsurl', { - set: function() { - ; - }, - get: function() { - return ''; - } - }); - Object.defineProperty(window, '__lturl', { - set: function() { - ; - }, - get: function() { - return ''; - } - }); + Object.defineProperty(window, '__durl', descriptor); + Object.defineProperty(window, '__lsurl', descriptor); + Object.defineProperty(window, '__lturl', descriptor); } catch (ex) { } })(); diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index c53638744..6264cfbbb 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.4.1", + "version": "1.5.0", "default_locale": "en", "description": "__MSG_extShortDesc__", diff --git a/platform/opera/manifest.json b/platform/opera/manifest.json index a25edb336..c4a7c13e6 100644 --- a/platform/opera/manifest.json +++ b/platform/opera/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.4.1", + "version": "1.5.0", "default_locale": "en", "description": "__MSG_extShortDesc__", diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index e99233305..408771ed1 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -141,15 +141,15 @@ var netFilters = function(details) { // Library of redirection resources: // https://github.com/gorhill/uBlock/blob/master/assets/ublock/resources.txt -var injectScripts = function(dataURIs) { +var injectScripts = function(scripts) { var parent = document.head || document.documentElement; if ( !parent ) { return; } - var i = dataURIs.length, scriptTag; + var i = scripts.length, scriptTag; while ( i-- ) { scriptTag = document.createElement('script'); - scriptTag.src = dataURIs[i]; + scriptTag.appendChild(document.createTextNode(scripts[i])); parent.appendChild(scriptTag); } }; @@ -169,7 +169,7 @@ var filteringHandler = function(details) { if ( details.netHide.length !== 0 ) { netFilters(details); } - if ( details.scripts !== 0 ) { + if ( Array.isArray(details.scripts) ) { injectScripts(details.scripts); } // The port will never be used again at this point, disconnecting allows diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index d38b61aed..a6ffb90c8 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -1103,13 +1103,13 @@ FilterContainer.prototype.retrieveScriptTags = function(domain, hostname) { return; } var out = [], - hn = hostname, pos, rnames, i, dataURI; + hn = hostname, pos, rnames, i, content; for (;;) { rnames = this.scriptTags[hn]; i = rnames && rnames.length || 0; while ( i-- ) { - if ( (dataURI = reng.resourceFromName(rnames[i], 'application/javascript')) ) { - out.push(dataURI); + if ( (content = reng.resourceContentFromName(rnames[i], 'application/javascript')) ) { + out.push(content); } } if ( hn === domain ) { @@ -1123,12 +1123,11 @@ FilterContainer.prototype.retrieveScriptTags = function(domain, hostname) { } pos = domain.indexOf('.'); if ( pos !== -1 ) { - hn = domain.slice(0, pos); - rnames = this.scriptTags[hn]; + rnames = this.scriptTags[domain.slice(0, pos)]; i = rnames && rnames.length || 0; while ( i-- ) { - if ( (dataURI = reng.resourceFromName(rnames[i], 'application/javascript')) ) { - out.push(dataURI); + if ( (content = reng.resourceContentFromName(rnames[i], 'application/javascript')) ) { + out.push(content); } } } diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index cc094fb60..f642984ac 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -42,48 +42,42 @@ var toBroaderHostname = function(hostname) { var RedirectEntry = function() { this.mime = ''; - this.encoded = false; - this.ph = false; this.data = ''; }; /******************************************************************************/ -RedirectEntry.rePlaceHolders = /\{\{.+?\}\}/; -RedirectEntry.reRequestURL = /\{\{requestURL\}\}/g; +RedirectEntry.prototype.toURL = function() { + if ( this.data.startsWith('data:') === false ) { + if ( this.mime.indexOf(';') === -1 ) { + this.data = 'data:' + this.mime + ';base64,' + btoa(this.data); + } else { + this.data = 'data:' + this.mime + ',' + this.data; + } + } + return this.data; +}; /******************************************************************************/ -RedirectEntry.prototype.toURL = function(requestURL) { - if ( this.ph === false ) { - return this.data; +RedirectEntry.prototype.toContent = function() { + if ( this.data.startsWith('data:') ) { + var pos = this.data.indexOf(','); + var base64 = this.data.endsWith(';base64', pos); + this.data = this.data.slice(pos + 1); + if ( base64 ) { + this.data = atob(this.data); + } } - return 'data:' + - this.mime + ';base64,' + - btoa(this.data.replace(RedirectEntry.reRequestURL, requestURL)); + return this.data; }; /******************************************************************************/ RedirectEntry.fromFields = function(mime, lines) { var r = new RedirectEntry(); - r.mime = mime; - r.encoded = mime.indexOf(';') !== -1; - var data = lines.join(r.encoded ? '' : '\n'); - // check for placeholders. - r.ph = r.encoded === false && RedirectEntry.rePlaceHolders.test(data); - if ( r.ph ) { - r.data = data; - } else { - r.data = - 'data:' + - mime + - (r.encoded ? '' : ';base64') + - ',' + - (r.encoded ? data : btoa(data)); - } - + r.data = lines.join(mime.indexOf(';') !== -1 ? '' : '\n'); return r; }; @@ -91,12 +85,8 @@ RedirectEntry.fromFields = function(mime, lines) { RedirectEntry.fromSelfie = function(selfie) { var r = new RedirectEntry(); - r.mime = selfie.mime; - r.encoded = selfie.encoded; - r.ph = selfie.ph; r.data = selfie.data; - return r; }; @@ -167,7 +157,7 @@ RedirectEngine.prototype.toURL = function(context) { } var entry = this.resources[token]; if ( entry !== undefined ) { - return entry.toURL(context.requestURL); + return entry.toURL(); } }; @@ -359,7 +349,7 @@ RedirectEngine.prototype.fromSelfie = function(selfie) { /******************************************************************************/ -RedirectEngine.prototype.resourceFromName = function(name, mime) { +RedirectEngine.prototype.resourceURIFromName = function(name, mime) { var entry = this.resources[name]; if ( entry && (mime === undefined || entry.mime.startsWith(mime)) ) { return entry.toURL(); @@ -368,6 +358,15 @@ RedirectEngine.prototype.resourceFromName = function(name, mime) { /******************************************************************************/ +RedirectEngine.prototype.resourceContentFromName = function(name, mime) { + var entry = this.resources[name]; + if ( entry && (mime === undefined || entry.mime.startsWith(mime)) ) { + return entry.toContent(); + } +}; + +/******************************************************************************/ + // TODO: combine same key-redirect pairs into a single regex. RedirectEngine.prototype.resourcesFromString = function(text) {