Bug 57829 - Web Inspector: Range insertNode function does not update content in the inspector
Summary: Web Inspector: Range insertNode function does not update content in the inspe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-05 05:08 PDT by Alexander Pavlov (apavlov)
Modified: 2011-04-06 03:01 PDT (History)
10 users (show)

See Also:


Attachments
[PATCH] Suggested fix (8.07 KB, patch)
2011-04-05 07:38 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Added a test case to an existing test instead of a new one (8.51 KB, patch)
2011-04-05 07:52 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Simplified patch, as suggested by pfeldman (5.77 KB, patch)
2011-04-05 09:27 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
Details | Formatted Diff | Diff
[PATCH] Comment addressed (6.16 KB, patch)
2011-04-05 10:19 PDT, Alexander Pavlov (apavlov)
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>