Commit 38174b9
Replay id registrations at the node they were registered for (#356)
The shadow's id registry recorded only the attribute name and namespace,
so the replay registered every matching attribute of the private copy.
That is not a harmless superset: an element the caller never registered,
sharing the id value and coming first, claims the value at xmlGetID and
the intended element is skipped — a "#id" signature reference then
resolves to content the caller never vouched for.
The registry now keeps the registered elements themselves, and the replay
applies each spec at the copy's counterpart of its element: that node
alone for register_id, its subtree for add_ids (the scope xmlSecAddIDs
walks). Liveness stays decidable without weak references — every element
proxy holds a reference to its document, so an entry is dead when the
document's reference count is exactly what the registry holds and nothing
else holds its elements.
Two other faithfulness gaps in the copy, from the same review:
- the whole-document and subtree parses dropped the source document's
base URI; they now carry docinfo.URL, so relative references resolve
where they did before the copy.
- the reflection recorded a text-slot sync only for a parent that gained
a fresh node, so a call that *removed* a node and left nothing fresh
behind (an EncryptedData decrypting to empty content) went unnoticed.
Each pre-existing node is now tagged with its child count, and a parent
whose tagged children changed is synced too.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 97cb993 commit 38174b9
6 files changed
Lines changed: 437 additions & 136 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
0 commit comments