-
Notifications
You must be signed in to change notification settings - Fork 118
Webview extension: add .get_resource() for serving from memory
#477
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ends on package format)
abique
reviewed
Oct 28, 2025
abique
added a commit
that referenced
this pull request
Oct 29, 2025
* Start `clap.web` draft
* Clarified `web_start` URL resolution ("bundle resource" directory depends on package format)
* `web` -> `webview`
* Move everything to `[main-thread]` except `is_open()`, add `clap.gui` API constant
* Correct include in `all.h`
* Remove `is_open()`, since this can be known from `clap.gui`.
* `provide_starting_uri` comment since bundles aren't always defined
* Bump webview draft to `/2` since I'm already using the `/1` for stuff
* Separate URI length-query function
* Single method for length/contents checks
* Allow hosts to rewrite `file:` URLs
* `clap.webview/3`: add `.get_resource()` function for serving from memory
---------
Co-authored-by: Alexandre Bique <[email protected]>
abique
pushed a commit
that referenced
this pull request
Nov 3, 2025
abique
pushed a commit
that referenced
this pull request
Nov 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on using the extension for a while, and talking to other devs: it's common for webview resources to be included in the binary itself, and served from memory. An extension which only supports resources served from disk doesn't cover a sufficient range of situations.
Although this change adds another function, it simplifies the spec for relative URLs. Instead of dealing with "bundle resource directory" (which isn't defined for all platforms), relative URLs are handled by a custom
GET-only resource provider. Whether these resources are from the binary's data or a bundle/etc. is up to the plugin. The plugin can still returnfile://URIs if it prefers.This poses no problem for native webviews, and should be possible (if awkward) for
<iframe>s.