onBeforeRequest details.webContentsId dissapears in release


Electron version: 2.0.3
Operating system: release in Macintosh
Expected behavior
onBeforeRequest should return the information of the webContent that has created the request. That information is inside details.webContentsId

Actual behavior
onBeforeRequest returns it when workign in development version and with the production on, however, when doing a package to create a release onBeforeRequest doesn’t return the webContentsId of the webContent that did the request


I am working in a project in where I have several webviews to load different websites that share the same session (of the type “persist:id”). I have developed an adblock system that works at the level of the webview that works in the following way:

let mySession = session.fromPartition(‘persist:id’);

session.webRequest.onBeforeRequest(['*://*./*'], (details, cb) => {
         if (adBlockActiveForSession(details.webContentsId)){
                  // adblock operations

This works in the development and with production flag. However, when I create a realease, it doesnt work. I noticed that, in the release, details doesnt have “webContentsId”. Also I have check the documentation https://electronjs.org/docs/api/web-request and it says that the webContentsId is optional

when webContentsId can be access in details and when it can’t? why it works in development but not when I create a release?

Thank you

note: In order to insure that the webview has its webContent id, before loading an url I load an empty site, and after dom ready, I start to do the real url loadings.


Nobody has experience the same? No matter what I do, when I do a release, onBeforeRequest doesnt show the webContentsId…


I have confirmed that doing a windows release has the same bug (onBeforeRequest won’t return webContentsId).

Nobody knows anything about why this happens? Can it be considered a bug or I am forgetting something? (f.e. adding a flag when I do a release or using another event…)