Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1714)

Unified Diff: Source/core/xml/XMLViewer.js

Issue 23604028: [XML Viewer crash] Store the reference of pretty-print div as tree to be used during the processing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlviewer/dumpAsText/xmlviewer-root-element-id-tree-appearing-blank-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLViewer.js
diff --git a/Source/core/xml/XMLViewer.js b/Source/core/xml/XMLViewer.js
index 049779b6343ac95fb67cf46841e624cd1b4461d8..afb79b6c0a35ff1f1505e3d0e8f40a0948645492 100644
--- a/Source/core/xml/XMLViewer.js
+++ b/Source/core/xml/XMLViewer.js
@@ -72,6 +72,11 @@ function sourceXMLLoaded()
var sourceXML = document.getElementById('webkit-xml-viewer-source-xml');
if (!sourceXML)
return; // Stop if some XML tree extension is already processing this document
+
+ // Momentarily detach the sourceXML from the DOM in order to not clash with
+ // any elements in the source XML having id="tree" attribute.
+ sourceXML.parentNode.removeChild(sourceXML);
+
var root = document.getElementById('tree');
abarth-chromium 2013/09/04 02:02:40 Why not save off the |tree| reference instead of c
for (var child = sourceXML.firstChild; child; child = child.nextSibling)
@@ -83,6 +88,9 @@ function sourceXMLLoaded()
drawArrows();
initButtons();
+ // Processing of the XML document is complete. Now attach the sourceXML back into the body
+ document.body.appendChild(sourceXML);
+
if (typeof(onAfterWebkitXMLViewerLoaded) == 'function')
onAfterWebkitXMLViewerLoaded();
}
« no previous file with comments | « LayoutTests/http/tests/xmlviewer/dumpAsText/xmlviewer-root-element-id-tree-appearing-blank-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698