Repository navigation
Commit 06aab59
committed
fix(webview): refuse a stored view id the host would not accept
getViewStateId() reused any stored string that survived normalization, so a persisted id
longer than 64 characters came back on every launch while the extension refused to store
it: the "Ignoring an oversized viewStateId" log (ClineProvider.ts:945-947) meant this view
stayed on its pre-launch temporary id forever, which is the stranded state the reuse path
exists to avoid. The wrapper now declares MAX_VIEW_STATE_ID_LENGTH = 64 - the host keeps
its own copy private and the webview cannot import it - and refuses an id above it, while
still reusing the largest legal id rather than minting a new one away from real per-view
state.
The comment also claimed the host rejects every Object.prototype member name. It does not:
setViewStateId refuses only "__proto__" by name (ClineProvider.ts:938). The webview still
refuses every prototype member, deliberately stricter than the host rather than a mirror:
those names are useless keys on this side, because writing them into the state object goes
through the prototype setter and the later spread drops them. The length cap is the part
that mirrors the host, and the comment now says which is which. The same overstated claim
in the prototype-member case comment was corrected too.
Test first: both cases were written against the constant before the cap existed, and the
oversize case failed exactly as expected - 1 failed / 17 passed, returning the stored
65-character id. Control with only the length disjunct removed: 1 failed / 17 passed,
failing only "generates and persists a fresh id when the stored id is longer than the host
limit". vscode.spec.ts is 16 passed before this commit and 18 after. The whole webview-ui
suite is green: 188 files / 2508 tests. tsc clean (root typescript against the webview-ui
project), eslint clean on both files, prettier clean; src/ is untouched here so
src/eslint-suppressions.json is unchanged.
Answers #1560 review row 4477606394.1 parent 4fb086f commit 06aab59
2 files changed
Lines changed: 58 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
288 | 324 | | |
289 | 325 | | |
290 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| |||
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
64 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| |||
0 commit comments