diff --git a/CHANGELOG.md b/CHANGELOG.md index 998dcd7ce7..85a89e10d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ *not released* +## 1.0.2 + +*2019-09-02* + + * fix: do not block main document requests [#312](https://github.com/cliqz-oss/adblocker/pull/312) + ## 1.0.1 *2019-08-28* diff --git a/lerna.json b/lerna.json index 4cf519e7fa..2255215729 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "npmClient": "yarn", "useWorkspaces": true, - "version": "1.0.1" + "version": "1.0.2" } diff --git a/packages/adblocker-benchmarks/package.json b/packages/adblocker-benchmarks/package.json index 44075dc44d..a9e4f0a7db 100644 --- a/packages/adblocker-benchmarks/package.json +++ b/packages/adblocker-benchmarks/package.json @@ -1,7 +1,7 @@ { "name": "@cliqz/adblocker-benchmarks", "private": true, - "version": "1.0.1", + "version": "1.0.2", "description": "Content blockers benchmark", "author": { "name": "Cliqz" @@ -25,7 +25,7 @@ "adblock-rs": "^0.1.22" }, "dependencies": { - "@cliqz/adblocker": "^1.0.1", + "@cliqz/adblocker": "^1.0.2", "jsdom": "^15.1.1", "sandboxed-module": "^2.0.3" }, diff --git a/packages/adblocker-circumvention/package.json b/packages/adblocker-circumvention/package.json index 67480ed8ae..9a73223e0d 100644 --- a/packages/adblocker-circumvention/package.json +++ b/packages/adblocker-circumvention/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-circumvention", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker circumvention for Chrome", "author": { "name": "Cliqz" @@ -78,6 +78,6 @@ "typescript": "^3.5.3" }, "dependencies": { - "@cliqz/adblocker-content": "^1.0.1" + "@cliqz/adblocker-content": "^1.0.2" } } diff --git a/packages/adblocker-content/package.json b/packages/adblocker-content/package.json index d3dfdc1c33..3907a809c0 100644 --- a/packages/adblocker-content/package.json +++ b/packages/adblocker-content/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-content", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker library (content-scripts helpers)", "author": { "name": "Cliqz" diff --git a/packages/adblocker-electron-example/package.json b/packages/adblocker-electron-example/package.json index 978c6bdba6..5ced477297 100644 --- a/packages/adblocker-electron-example/package.json +++ b/packages/adblocker-electron-example/package.json @@ -1,7 +1,7 @@ { "name": "@cliqz/adblocker-electron-example", "private": true, - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker Puppeteer wrapper", "author": { "name": "Cliqz" @@ -59,7 +59,7 @@ } ], "dependencies": { - "@cliqz/adblocker-electron": "^1.0.1", + "@cliqz/adblocker-electron": "^1.0.2", "electron": "^6.0.1", "node-fetch": "^2.6.0", "ts-node": "^8.3.0" diff --git a/packages/adblocker-electron/adblocker.ts b/packages/adblocker-electron/adblocker.ts index b873a0b7bf..0f76e99c77 100644 --- a/packages/adblocker-electron/adblocker.ts +++ b/packages/adblocker-electron/adblocker.ts @@ -145,7 +145,13 @@ export class ElectronBlocker extends FiltersEngine { details: Electron.OnBeforeRequestDetails, callback: (a: Electron.Response) => void, ): void => { - const { redirect, match } = this.match(fromElectronDetails(details)); + const request = fromElectronDetails(details); + if (request.isMainFrame()) { + callback({}); + return; + } + + const { redirect, match } = this.match(request); if (redirect) { callback({ redirectURL: redirect.dataUrl }); diff --git a/packages/adblocker-electron/package.json b/packages/adblocker-electron/package.json index 821d6b545f..1a771bea3c 100644 --- a/packages/adblocker-electron/package.json +++ b/packages/adblocker-electron/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-electron", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker Electron wrapper", "author": { "name": "Cliqz" @@ -37,8 +37,8 @@ "electron": "^6.0.1" }, "dependencies": { - "@cliqz/adblocker": "^1.0.1", - "@cliqz/adblocker-content": "^1.0.1" + "@cliqz/adblocker": "^1.0.2", + "@cliqz/adblocker-content": "^1.0.2" }, "devDependencies": { "@types/chrome": "^0.0.88", diff --git a/packages/adblocker-puppeteer-example/package.json b/packages/adblocker-puppeteer-example/package.json index 872c92f9f1..78481ce395 100644 --- a/packages/adblocker-puppeteer-example/package.json +++ b/packages/adblocker-puppeteer-example/package.json @@ -1,7 +1,7 @@ { "name": "@cliqz/adblocker-puppeteer-example", "private": true, - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker Puppeteer wrapper", "author": { "name": "Cliqz" @@ -24,7 +24,7 @@ "url": "https://github.com/cliqz-oss/adblocker/issues" }, "dependencies": { - "@cliqz/adblocker-puppeteer": "^1.0.1", + "@cliqz/adblocker-puppeteer": "^1.0.2", "node-fetch": "^2.6.0", "puppeteer": "^1.18.1", "ts-node": "^8.3.0" diff --git a/packages/adblocker-puppeteer/adblocker.ts b/packages/adblocker-puppeteer/adblocker.ts index d6eaed53d9..330dc51b9f 100644 --- a/packages/adblocker-puppeteer/adblocker.ts +++ b/packages/adblocker-puppeteer/adblocker.ts @@ -113,19 +113,25 @@ export class PuppeteerBlocker extends FiltersEngine { } } - private onRequest = (request: puppeteer.Request): void => { - const { redirect, match } = this.match(fromPuppeteerDetails(request)); + private onRequest = (details: puppeteer.Request): void => { + const request = fromPuppeteerDetails(details) + if (request.isMainFrame()) { + details.continue(); + return; + } + + const { redirect, match } = this.match(request); if (redirect !== undefined) { const { body, contentType } = redirect; - request.respond({ + details.respond({ body, contentType, }); } else if (match === true) { - request.abort('blockedbyclient'); + details.abort('blockedbyclient'); } else { - request.continue(); + details.continue(); } } } diff --git a/packages/adblocker-puppeteer/package.json b/packages/adblocker-puppeteer/package.json index b2a74290c1..77f686f26d 100644 --- a/packages/adblocker-puppeteer/package.json +++ b/packages/adblocker-puppeteer/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-puppeteer", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker Puppeteer wrapper", "author": { "name": "Cliqz" @@ -37,8 +37,8 @@ "puppeteer": "^1.18.1" }, "dependencies": { - "@cliqz/adblocker": "^1.0.1", - "@cliqz/adblocker-content": "^1.0.1", + "@cliqz/adblocker": "^1.0.2", + "@cliqz/adblocker-content": "^1.0.2", "@types/puppeteer": "^1.12.4", "tldts-experimental": "^5.3.0" }, diff --git a/packages/adblocker-webextension-cosmetics/package.json b/packages/adblocker-webextension-cosmetics/package.json index a4a7bfc206..a9a86d42bb 100644 --- a/packages/adblocker-webextension-cosmetics/package.json +++ b/packages/adblocker-webextension-cosmetics/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-webextension-cosmetics", - "version": "1.0.1", + "version": "1.0.2", "description": "Enable cosmetics in WebExtension content blocker using Cliqz adblocker", "author": { "name": "Cliqz" @@ -84,6 +84,6 @@ "typescript": "^3.5.3" }, "dependencies": { - "@cliqz/adblocker-content": "^1.0.1" + "@cliqz/adblocker-content": "^1.0.2" } } diff --git a/packages/adblocker-webextension-example/package.json b/packages/adblocker-webextension-example/package.json index 451a48d906..f0e6f92b3e 100644 --- a/packages/adblocker-webextension-example/package.json +++ b/packages/adblocker-webextension-example/package.json @@ -1,7 +1,7 @@ { "name": "@cliqz/adblocker-webextension-example", "private": true, - "version": "1.0.1", + "version": "1.0.2", "description": "Example of WebExtension adblocker using Cliqz", "author": { "name": "Cliqz" @@ -29,8 +29,8 @@ "url": "https://github.com/cliqz-oss/adblocker/issues" }, "dependencies": { - "@cliqz/adblocker-webextension": "^1.0.1", - "@cliqz/adblocker-webextension-cosmetics": "^1.0.1" + "@cliqz/adblocker-webextension": "^1.0.2", + "@cliqz/adblocker-webextension-cosmetics": "^1.0.2" }, "devDependencies": { "@types/chrome": "^0.0.88", diff --git a/packages/adblocker-webextension/adblocker.ts b/packages/adblocker-webextension/adblocker.ts index 83f452315a..00401f0129 100644 --- a/packages/adblocker-webextension/adblocker.ts +++ b/packages/adblocker-webextension/adblocker.ts @@ -97,6 +97,10 @@ export class WebExtensionBlocker extends FiltersEngine { details: WebRequestBeforeRequestDetails, ): chrome.webRequest.BlockingResponse => { const request = fromWebRequestDetails(details); + if (request.isMainFrame()) { + return {}; + } + const { redirect, match } = this.match(request); if (redirect !== undefined) { diff --git a/packages/adblocker-webextension/package.json b/packages/adblocker-webextension/package.json index 21b7145259..dc1266ff8f 100644 --- a/packages/adblocker-webextension/package.json +++ b/packages/adblocker-webextension/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker-webextension", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker WebExtension wrapper", "author": { "name": "Cliqz" @@ -50,8 +50,8 @@ "typescript": "^3.5.3" }, "dependencies": { - "@cliqz/adblocker": "^1.0.1", - "@cliqz/adblocker-content": "^1.0.1", + "@cliqz/adblocker": "^1.0.2", + "@cliqz/adblocker-content": "^1.0.2", "tldts-experimental": "^5.3.0" }, "contributors": [ diff --git a/packages/adblocker/package.json b/packages/adblocker/package.json index 14409c4ebf..6deeef0464 100644 --- a/packages/adblocker/package.json +++ b/packages/adblocker/package.json @@ -1,6 +1,6 @@ { "name": "@cliqz/adblocker", - "version": "1.0.1", + "version": "1.0.2", "description": "Cliqz adblocker library", "author": { "name": "Cliqz"