Bug 57829

Summary: Web Inspector: Range insertNode function does not update content in the inspector
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: Web Inspector (Deprecated)Assignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Suggested fix
none
[PATCH] Added a test case to an existing test instead of a new one
none
[PATCH] Simplified patch, as suggested by pfeldman
pfeldman: review-
[PATCH] Comment addressed pfeldman: review+

Description Alexander Pavlov (apavlov) 2011-04-05 05:08:03 PDT
What steps will reproduce the problem?

At a web page like "http://news.ycombinator.com/item?id=1968304" I modified a <p> element, and added the attribute id='p12345'
i then typed in the following code into the console:

range = document.createRange();
referenceNode = document.getElementById('p12345').firstChild;
range.selectNode(referenceNode);
range.setStart(referenceNode, 89 );
range.setEnd(referenceNode, 89 + 5 );
range.deleteContents();
span = range.startContainer.ownerDocument.createElement('span');
span.innerHTML = 'test';
range.insertNode(span);

after running the above code, the html view updates, but the inspector does not.  it truncates after the insertion point.

What is the expected result?
the html in the inspector should properly update.

What happens instead?
after running the above code, the html view updates, but the inspector does not.  it truncates after the insertion point.

Upstreaming http://code.google.com/p/chromium/issues/detail?id=65424 with the code snippet fixed.
Comment 1 Alexander Pavlov (apavlov) 2011-04-05 07:38:29 PDT
Created attachment 88227 [details]
[PATCH] Suggested fix
Comment 2 Alexander Pavlov (apavlov) 2011-04-05 07:52:49 PDT
Created attachment 88234 [details]
[PATCH] Added a test case to an existing test instead of a new one
Comment 3 Alexander Pavlov (apavlov) 2011-04-05 09:27:05 PDT
Created attachment 88252 [details]
[PATCH] Simplified patch, as suggested by pfeldman
Comment 4 Pavel Feldman 2011-04-05 10:02:03 PDT
Comment on attachment 88252 [details]
[PATCH] Simplified patch, as suggested by pfeldman

View in context: https://bugs.webkit.org/attachment.cgi?id=88252&action=review

> Source/WebCore/inspector/InspectorDOMAgent.cpp:1100
> +    m_childrenRequested.add(bind(container, nodesMap));

Please remove all the other calls to m_childredRequested.add
Comment 5 Alexander Pavlov (apavlov) 2011-04-05 10:19:48 PDT
Created attachment 88267 [details]
[PATCH] Comment addressed
Comment 6 Yury Semikhatsky 2011-04-06 01:36:28 PDT
Comment on attachment 88267 [details]
[PATCH] Comment addressed

View in context: https://bugs.webkit.org/attachment.cgi?id=88267&action=review

> Source/WebCore/inspector/InspectorDOMAgent.cpp:1094
> +            return buildArrayForContainerChildren(container, 1, nodesMap);

Can you rewrite this if block to avoid the recursive call here?
Comment 7 Alexander Pavlov (apavlov) 2011-04-06 03:01:30 PDT
Committed r83037: <http://trac.webkit.org/changeset/83037>