Skip to content

Commit

Permalink
set 'Request.tabId' to 'webContentsId' in Electron platform
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Aug 16, 2019
1 parent 82396e5 commit 5ccf7c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

*not released*

## 0.13.1

*2019-08-16*

* set `Request.tabId` to `webContentsId` in Electron platform

## 0.13.0

*2019-08-16*
Expand Down
6 changes: 3 additions & 3 deletions packages/adblocker-electron-example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ async function createWindow() {
engine.enableBlockingInSession(session.defaultSession);

engine.on('request-blocked', (request: Request) => {
console.log('blocked', request.url);
console.log('blocked', request.tabId, request.url);
});

engine.on('request-redirected', (request: Request) => {
console.log('redirected', request.url);
console.log('redirected', request.tabId, request.url);
});

engine.on('request-whitelisted', (request: Request) => {
console.log('whitelisted', request.url);
console.log('whitelisted', request.tabId, request.url);
});

engine.on('csp-injected', (request: Request) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/adblocker-electron/adblocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export function fromElectronDetails({
url,
resourceType,
referrer,
webContentsId,
}: Electron.OnBeforeRequestDetails | Electron.OnHeadersReceivedDetails): Request {
return Request.fromRawDetails({
sourceUrl: referrer,
tabId: webContentsId,
type: (resourceType || 'other') as ElectronRequestType,
url,
});
Expand Down

0 comments on commit 5ccf7c1

Please sign in to comment.