Commit d1a4155
CMP-9545: Cache Storage API extra check for protocol (#5516)
Compose Multiplatform v1.10.0 introduced the use of the Cache Storage
API to avoid repeat http requests for resources on Web
([#5379](#5379)).
In a VsCode Extension Environment, the protocol of a Web View Panel that
gets used is "vscode-webview:". This does not work with the Cache
Storage API and results in an error when trying to load any compose
resources. This PR just ensures the protocol is http/https in order to
use Cache Storage API on Web Target.
Fixes
https://youtrack.jetbrains.com/issue/CMP-9545/ComposeResources-on-Web-not-loading-because-Cache-Storage-API-is-not-supported-everywhere
## Testing
**Describe how you tested your changes (provide a snippet or/and
steps)**
- I ran my vscode extension with the change and without the change
**without**
<img width="1658" height="753" alt="image"
src="https://github.com/user-attachments/assets/367f5a41-4b0b-4262-9d38-3baca1ce0125"
/>
**with**
<img width="1658" height="885" alt="image"
src="https://github.com/user-attachments/assets/b06415df-1388-45c2-a439-21e604fc2e54"
/>
- I ran a regular browserDevelopmentRun to ensure caching still worked
as expected
<img width="1863" height="942" alt="image"
src="https://github.com/user-attachments/assets/54e7dd47-084c-4514-b79b-32f35577dc92"
/>
## Release Notes
### Fixes - Resources
Fixes an issue where web resources failed to load when calling the Cache
Storage API with unsupported protocols (e.g., vscode-webview: in VS Code
webviews).
(cherry picked from commit 89f6aea)1 parent ed8a2c1 commit d1a4155
1 file changed
Lines changed: 5 additions & 1 deletion
File tree
- components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
0 commit comments