Bug 315583
| Summary: | Web Inspector: node highlight in object preview can diverge from preview text after the object is mutated | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Alice Tang <tang.alice.000> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | hi, inspector-bugzilla-changes, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=143206 | ||
Alice Tang
When hovering a DOM node in an object preview, the node is resolved live at hover time (arrays and plain objects via getProperty, collections via getCollectionEntries). If the object has been mutated since the preview was generated, the highlighted node won't match what the preview text shows.
For example:
let map = new Map([["a", document.body.children[0]]]);
console.log(map);
map.set("a", document.body.children[1]);
// hovering the "a" entry now highlights children[1] even though the
// preview still shows children[0]
This affects all preview types, not just collections. The root issue is that there's no direct link between a preview entry and the specific object that was snapshotted when the preview was generated.
The fix is probably to bind a RemoteObjectId to node entries at preview generation time, either by adding an optional objectId to Runtime.ObjectPreview or via a new parameter on Runtime.getPreview and commands that take generatePreview. That way hovering can resolve directly to the snapshotted object rather than refetching by name or index. Multiple RemoteObjectIds mapping to the same value should already be fine given how RemoteObjects work today.
See Also:
https://bugs.webkit.org/show_bug.cgi?id=143206
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alice Tang
<rdar://177979380>