Skip to content

Add cookie and site-data APIs with tests and docs#40

Merged
marcprux merged 2 commits intoskiptools:mainfrom
tifroz:codex/cookie_management
Mar 10, 2026
Merged

Add cookie and site-data APIs with tests and docs#40
marcprux merged 2 commits intoskiptools:mainfrom
tifroz:codex/cookie_management

Conversation

@tifroz
Copy link
Contributor

@tifroz tifroz commented Mar 10, 2026

  • cookie management APIs that mirror WKWebView's
  • data storage removal modeled after WKWebsiteDataStore.removeData(ofTypes:modifiedSince:)

(On Android the only timeframe that will not throw is .distantPast because of the underlying API's limitations)

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Codex generated the code under supervision. Tested manually from a native sandbox app

@cla-bot cla-bot bot added the cla-signed label Mar 10, 2026
@marcprux
Copy link
Member

Can you describe some scenarios where this is useful? Is it largely for letting user to do things like manually clearing cookies or viewing their attributes, or are there other uses like being able to programmatically set cookies in a browser session? What are your use cases for this?

@tifroz
Copy link
Contributor Author

tifroz commented Mar 10, 2026

  • Yes, user-facing cookie clearing is part of the use case (along with other data types)
  • For us, programmatic cookie management is used for session handoff and synchronization when authenticated traffic needs to be moved outside the original WebView context (background downloads for example).

Unrelated but I haven't been able to compile the SkipUI dependency after it was updated to 1.50.0. I had to force the version back to (.package(url: "https://github.com/skiptools/skip-ui.git", exact: "1.49.1")) in order to compile in XCode. It's a very recent change, and I'd rather not try to fix it without the proper context!

Here is the error:

...
skip-ui/Sources/SkipUI/SkipUI/UIKit/UserNotifications.swift:675:39: error: This API is not yet available in Skip. Consider placing it within a #if !SKIP block. You can file an issue against the owning library at https://github.com/skiptools, or see the library README for information on adding support
        guard let nextDate = calendar.nextDate(
                                      ^~~~~~~~

@marcprux
Copy link
Member

Unrelated but I haven't been able to compile the SkipUI dependency after it was updated to 1.50.0. I had to force the version back to (.package(url: "https://github.com/skiptools/skip-ui.git", exact: "1.49.1")) in order to compile in XCode. It's a very recent change, and I'd rather not try to fix it without the proper context!

That's odd. That error isn't why the CI is failing, which is a different issue that only happens in the iOS build:

Testing failed:

	Call to main actor-isolated static method 'androidRemovalBucketNames(for:)' in a synchronous nonisolated context
Test session results, code coverage, and logs:
	Call to main actor-isolated static method 'androidRemovalBucketNames(for:)' in a synchronous nonisolated context
	Call to main actor-isolated static method 'webKitDataTypes(for:)' in a synchronous nonisolated context
	Testing cancelled because the build failed.

For the calendar.nextDate issue, that was a new API that came in with skip-foundation 1.3.13, so you may just need to make sure your local checkout is up to do (e.g., delete your Package.resolved locally and/or run Xcode's File/Packages/Update to Latest Package Versions).

@tifroz
Copy link
Contributor Author

tifroz commented Mar 10, 2026

Yes the calendar.nextDate() compilation problem was happening in my local environment - fixed now (thanks for the tip)

The CI tests passed after the latest adjustments

Next, I'm planning to add profile support to skip-web, to power featues like transient profiles for private browsing (similar to Safari's Private Tabs). Currently, all webviews share a single cookie store on both Android + iOS.

Happy to fold this into the current PR rather than open a new one — let me know!

@marcprux
Copy link
Member

I'll merge this one and you can open a new PR for profiles so we can keep that size of the PRs small(-ish).

This is a great feature, thanks!

@marcprux marcprux merged commit 67af43c into skiptools:main Mar 10, 2026
2 checks passed
@tifroz tifroz deleted the codex/cookie_management branch March 10, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants