-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
feat: Add a way to launch WebViews as incognito WebView::as_incognito
, closes #908
#916
Conversation
Currently I only implemented this on Windows and WebKitGTK, I don't have a Mac or an iPhone so I can't do WKWebView that would be guaranteed to work and my computer is too slow to implement Android. |
Android would be unsupported as incognito mode would have to be called on the destructors and the non-destructor API is depreciated. Only thing now is I hope MacOS functionality could be verified as working as I can't test it. |
@Hyphrio It's okay to leave Android unsupported. Thank you for the work! I'll test them all once I get back. Btw I can't figure out how your example works. Can you elaborate? |
Uh the example is unfortunately still broken (on Windows) because of read-only access on the HTML file, I'll probably just spin up a temp HTTP server to work around that but that example just sets a cookie then when you close the window and reopen it it should attempt to load that cookie, but since it's incognito it will appear as nothing
|
WebKitGTK impl is currently broken so I converted this back to draft |
Hopefully Linux is fixed now (is_ephemeral was read-only, had to modify both WebContext and WebContextImpl to add a new function named new_ephemeral) |
Hello @Hyphrio, I can help test if the Mac fix works. So I just ran the The data store can be retrieved directly from the let data_store: id = msg_send![class!(WKWebsiteDataStore), defaultDataStore];
let data_store: id = msg_send![class!(WKWebsiteDataStore), nonPersistentDataStore]; And the data store can be set to let () = msg_send![config, setWebsiteDataStore: data_store]; |
Alright @pewsheen thank you for the insight about WKWebView! |
I want to make a note on Linux side. So the cookie is persist if we specify a web context even with incognito is enabled. I'll test macOS and windows later. Edit: Windows seems great. So it's only macOS left. |
We can test with existing sites instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with how this turns out. Thank you @Hyphrio!
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
Other information
This adds an option for
WebViewBuilder
to allow launching a WebView on incognito mode, to allow for things that would need epheremal instances, such as webview sign-ins.