You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Output of node_modules/.bin/electron --version: v4.0.3
Operating System (Platform and Version): OS X v10.13.6
Expected Behavior
in webRequest.onCompleted() handler, we are passed a details object of type OnCompletedDetails which contains a referrer attribute.
Actual behavior
Both the documentation for weebRequest and type definition of OnCompletedDetails omit the referrer attribute, but it is there.
I was initially concerned about this, because I'm updating an existing electron 2.x app to electron 4.x. The app had a webContents did-get-response-details event handler, which has been removed in electron 4.x, and the handler requires the referrer attribute to work.
However, when I added a hander for webRequest.onCompleted and inspected the details object I was happy to find that it does indeed set the referrer attribute. The only issue now is that the typescript compiler complains when I access it:
error TS2339: Property 'referrer' does not exist on type 'OnCompletedDetails'.
As of now, I'm just casting it as any to get around the compile error.
To Reproduce
I don't think full repo is necessary on this one. Just add this in any electron app (main process) and compile with typescript (using typescript v3.2.4 in this case)
import {session} from 'electron'
session.defaultSession.onCompleted((details) => {
console.log('onCompleted:', details.referrer)
})
Solution
The type definition for OnCompletedDetails just needs an additional line.
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
Aha... looks like the typescript definitions are automatically generated from the API docs. Pretty cool. I guess the solution is actually to update the docs for webRequest.onCompleted to include the referrer attribute.
node_modules/.bin/electron --version
: v4.0.3Expected Behavior
in
webRequest.onCompleted()
handler, we are passed adetails
object of typeOnCompletedDetails
which contains areferrer
attribute.Actual behavior
Both the documentation for
weebRequest
and type definition ofOnCompletedDetails
omit thereferrer
attribute, but it is there.I was initially concerned about this, because I'm updating an existing electron 2.x app to electron 4.x. The app had a webContents
did-get-response-details
event handler, which has been removed in electron 4.x, and the handler requires thereferrer
attribute to work.However, when I added a hander for
webRequest.onCompleted
and inspected thedetails
object I was happy to find that it does indeed set thereferrer
attribute. The only issue now is that the typescript compiler complains when I access it:As of now, I'm just casting it as
any
to get around the compile error.To Reproduce
I don't think full repo is necessary on this one. Just add this in any electron app (main process) and compile with typescript (using typescript v3.2.4 in this case)
Solution
The type definition for
OnCompletedDetails
just needs an additional line.electron.d.ts:
The text was updated successfully, but these errors were encountered: