webview.webContents.addListener returns an empty object

Open
#148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
electron, javascript, typescript
Domain
desktop

Research direction

Start by reproducing the webContents.fromId(...).addListener('will-navigate', ...) example from the issue and inspect how the Electron remote bridge handles the event argument. Done means the listener receives the event data rather than an empty object, including fields such as url and type.

Written by the indexing model from the issue text.

Description

Expected Behavior
const webview = webContents.fromId(webviewel.getWebContentsId())
webview.addListener('will-navigate', e => console.log(e))

This code must return an object like this

{
    isTrusted: false
    url: "https://mail.google.com/"
    bubbles: false
    cancelBubble: false
    cancelable: false
    composed: false
    currentTarget: null
    defaultPrevented: false
    eventPhase: 0
    returnValue: true
    srcElement: webview#webview.w-screen.h-[calc(100vh-40px)]
    target: webview#webview.w-screen.h-[calc(100vh-40px)]
    timeStamp: 1475.2000000001863
    type: "will-navigate"
}
Actual Behavior

But returns an empty object with no data

{}

I do not understand the issue here properly. Please get to me as soon as possible.

Dominant language
TypeScript
Stars
411
Forks
53
Avg merge
3m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from electron/remote

All issues in electron/remote

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.