From 2999dbee5ccce6cfdf95174147ff1417bf3b4ddf Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 20 Feb 2018 10:46:47 -0500 Subject: [PATCH] force "slow" path for scriplet injection for the time being (see #3526, https://github.com/uBlockOrigin/uAssets/issues/1492) --- platform/chromium/manifest.json | 2 +- src/js/messaging.js | 22 ++++++++++++++++------ src/js/traffic.js | 11 ++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index b43a9e5b7..cdf923559 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.15.8", + "version": "1.15.10", "commands": { "launch-element-zapper": { diff --git a/src/js/messaging.js b/src/js/messaging.js index 7ce4476c6..6636cbf4f 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -513,15 +513,25 @@ var onMessage = function(request, sender, callback) { request.entity = µb.URI.entityFromDomain(request.domain); response.specificCosmeticFilters = µb.cosmeticFilteringEngine.retrieveDomainSelectors(request, response); + + // https://github.com/gorhill/uBlock/issues/3526 + // https://github.com/uBlockOrigin/uAssets/issues/1492 + // Two distinct issues, but both are arising as a result of + // injecting scriptlets through stream filtering. So falling back + // to "slow" scriplet injection for the time being. Stream filtering + // (`##^`) should be used for when scriptlets are defeated by early + // script tags on a page. + // // If response body filtering is supported, than the scriptlets have // already been injected. - if ( - µb.canFilterResponseBody === false || - µb.textEncode === undefined || - µb.textEncode.normalizeCharset(request.charset) === undefined - ) { + //if ( + // µb.canFilterResponseBody === false || + // µb.textEncode === undefined || + // µb.textEncode.normalizeCharset(request.charset) === undefined + //) { response.scriptlets = µb.scriptletFilteringEngine.retrieve(request); - } + //} + if ( request.isRootFrame && µb.logger.isEnabled() ) { µb.logCosmeticFilters(tabId); } diff --git a/src/js/traffic.js b/src/js/traffic.js index 2ed04abad..825c2ac88 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -839,7 +839,16 @@ var filterDocument = (function() { charset: undefined }; request.selectors = µb.htmlFilteringEngine.retrieve(request); - request.scriptlets = µb.scriptletFilteringEngine.retrieve(request); + + // https://github.com/gorhill/uBlock/issues/3526 + // https://github.com/uBlockOrigin/uAssets/issues/1492 + // Two distinct issues, but both are arising as a result of + // injecting scriptlets through stream filtering. So falling back + // to "slow" scriplet injection for the time being. Stream filtering + // (`##^`) should be used for when scriptlets are defeated by early + // script tags on a page. + // + //request.scriptlets = µb.scriptletFilteringEngine.retrieve(request); if ( request.selectors === undefined &&