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

Feature/web preferences #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jmercouris
Copy link
Member

I will need to test this within the context of Nyxt to see whether I can actually use the web-contents initarg in order to take a given view and change its preferences. I don't think we'll be able to. Probably we'll have to create a new view, with a new web-contents, and just append the previous web-preferences object.

Additionally, dynamically calculate the options. If the user manually
specifies the options when creating a `view`, then use it, otherwise
serialize/encode the `web-preferences` object.
@jmercouris jmercouris requested a review from aadcg December 23, 2024 21:45
@jmercouris
Copy link
Member Author

jmercouris commented Dec 29, 2024

After investigating more, I do not believe it is possible to create a new webContents object outside of a WebContentsView. Looking at the documentation:

 This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

https://www.electronjs.org/docs/latest/api/web-contents#class-webcontents

Therefore, I think this is the best solution we have to persist and mutate webPreferences. We'll just have to create new WebContentsViews to replace old ones whenever we make changes.

When we mutate a webPreferences object, it is unclear how we'll signal to the WebContentsView that it needs to be recreated. I almost believe that this should be the responsibility of the user of the WebContentsView, and not the responsibility of the class itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant