Repository navigation
Commit 4dcc7ad
committed
fix(webview): keep the host-owned viewStates map out of the renderer settings write
Two review rows on this branch:
- webviewMessageHandler.ts: the updateSettings loop wrote every key the payload carried
through provider.setValue, so a renderer that included viewStates would overwrite every
view persisted mode and pin in one shot and bypass the ownership checks in setViewStateId.
The import path and both API writes already refuse that key through isNonPortableSettingsKey;
this write path now follows the same rule.
- TranslationContext.locale-loading.spec.tsx: the new cases awaited loadLanguage themselves,
which supplies the bundle even to a provider that deferred the load or switched language
later. They now capture the provider own call (spying the module export and recording the
promise it returns) and await that, so the assertion depends on the provider starting the
load rather than on the test starting it.
Measured first: the viewStates case fails at 06aab59 with "expected the mock to not be
called with arguments: [ viewStates, Anything ]". With the provider effect changed so it no
longer calls loadLanguage, the locale case fails on its recorded-call assertion with
"expected 0 to be greater than 0", which the old form would have passed.
webviewMessageHandler.spec.ts 177 passed, TranslationContext.locale-loading.spec.tsx 6
passed, src tsc 0 errors, eslint 0 problems, webview-ui tsc clean, prettier clean, no
suppression changes.1 parent 06aab59 commit 4dcc7ad
3 files changed
Lines changed: 59 additions & 7 deletions
File tree
- src/core/webview
- __tests__
- webview-ui/src/i18n/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2242 | 2242 | | |
2243 | 2243 | | |
2244 | 2244 | | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
2245 | 2266 | | |
2246 | 2267 | | |
2247 | 2268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
933 | 934 | | |
934 | 935 | | |
935 | 936 | | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
936 | 944 | | |
937 | 945 | | |
938 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
9 | 22 | | |
10 | 23 | | |
11 | 24 | | |
| |||
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
41 | 64 | | |
42 | 65 | | |
43 | 66 | | |
| |||
54 | 77 | | |
55 | 78 | | |
56 | 79 | | |
57 | | - | |
| 80 | + | |
58 | 81 | | |
59 | 82 | | |
60 | 83 | | |
| |||
77 | 100 | | |
78 | 101 | | |
79 | 102 | | |
80 | | - | |
| 103 | + | |
81 | 104 | | |
82 | 105 | | |
83 | 106 | | |
| |||
97 | 120 | | |
98 | 121 | | |
99 | 122 | | |
100 | | - | |
| 123 | + | |
101 | 124 | | |
102 | 125 | | |
103 | 126 | | |
| |||
121 | 144 | | |
122 | 145 | | |
123 | 146 | | |
124 | | - | |
| 147 | + | |
125 | 148 | | |
126 | 149 | | |
127 | 150 | | |
| |||
143 | 166 | | |
144 | 167 | | |
145 | 168 | | |
146 | | - | |
| 169 | + | |
147 | 170 | | |
148 | 171 | | |
149 | 172 | | |
| |||
163 | 186 | | |
164 | 187 | | |
165 | 188 | | |
166 | | - | |
| 189 | + | |
167 | 190 | | |
168 | 191 | | |
169 | 192 | | |
| |||
0 commit comments