Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: BrowserView.webContents can be null, but typescript types are incorrect #40567

Open
3 tasks done
Juice10 opened this issue Nov 20, 2023 · 2 comments · May be fixed by #40569
Open
3 tasks done

[Bug]: BrowserView.webContents can be null, but typescript types are incorrect #40567

Juice10 opened this issue Nov 20, 2023 · 2 comments · May be fixed by #40569
Labels
27-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/

Comments

@Juice10
Copy link

Juice10 commented Nov 20, 2023

Preflight Checklist

Electron Version

27.1.0

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.1.1 (23B81)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

Since this PR allows BrowserView.webContents to be null, I would expect the BrowserView typescript types to be something like this:

class BrowserView {

    // ...    

    /**
     * A `WebContents` object owned by this view.
     *
     * @experimental
     */
    webContents: WebContents | null;
  }

Actual Behavior

But in reality this is what it is.

class BrowserView {

    // ...    

    /**
     * A `WebContents` object owned by this view.
     *
     * @experimental
     */
    webContents: WebContents;
  }

Testcase Gist URL

https://gist.github.com/Juice10/09c54147930f951c4d3146b3443664b1

Additional Information

No response

Juice10 added a commit to Juice10/electron that referenced this issue Nov 20, 2023
Fixes: electron#40567

`null` was introduced as a possibility for destroyed webContents in this PR: electron#25411
@Juice10 Juice10 linked a pull request Nov 20, 2023 that will close this issue
3 tasks
@jkleinsc jkleinsc added 27-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels Jan 9, 2024
@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@Juice10
Copy link
Author

Juice10 commented Apr 9, 2024

I still need to finish this, it's on my todo list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
27-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects
None yet
2 participants