Title: [151080] trunk
Revision
151080
Author
[email protected]
Date
2013-06-02 01:14:48 -0700 (Sun, 02 Jun 2013)

Log Message

Unstyled XML viewer crashes when XML contains an element with id="tree"
https://bugs.webkit.org/show_bug.cgi?id=117117
<rdar://problem/13727267>

Reviewed by Darin Adler.

Source/WebCore:

Test: http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml

* xml/XMLViewer.css: Removed the rule to hide source document, as we no longer
keep it in the tree.

* xml/XMLViewer.js:
(prepareWebKitXMLViewer): Make sourceXML a detached tree, as otherwise it can
have ID conflicts with elements we add.
(sourceXMLLoaded): Removed some commented out code. Removed code that was checking
whether an extension took over XML display, as it makes no sense to duplicate this
functionality in an extension.

LayoutTests:

* http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml: Added.

* xmlviewer: Removed.
* xmlviewer/extensions-api-expected.txt: Removed.
* xmlviewer/extensions-api.html: Removed.
* xmlviewer/resources: Removed.
* xmlviewer/resources/sample.xml: Removed.
The "API" no longer exists.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151079 => 151080)


--- trunk/LayoutTests/ChangeLog	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/LayoutTests/ChangeLog	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1,3 +1,21 @@
+2013-06-02  Alexey Proskuryakov  <[email protected]>
+
+        Unstyled XML viewer crashes when XML contains an element with id="tree"
+        https://bugs.webkit.org/show_bug.cgi?id=117117
+        <rdar://problem/13727267>
+
+        Reviewed by Darin Adler.
+
+        * http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt: Added.
+        * http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml: Added.
+
+        * xmlviewer: Removed.
+        * xmlviewer/extensions-api-expected.txt: Removed.
+        * xmlviewer/extensions-api.html: Removed.
+        * xmlviewer/resources: Removed.
+        * xmlviewer/resources/sample.xml: Removed.
+        The "API" no longer exists.
+
 2013-06-01  Chris Fleizach  <[email protected]>
 
         WebKit ignores aria-hidden when traversing nodes for name calculation

Added: trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt (0 => 151080)


--- trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt	2013-06-02 08:14:48 UTC (rev 151080)
@@ -0,0 +1,4 @@
+This XML file does not appear to have any style information associated with it. The document tree is shown below.
+<INTERFACE>
+<OBJECT id="tree"/>
+</INTERFACE>

Added: trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml (0 => 151080)


--- trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml	2013-06-02 08:14:48 UTC (rev 151080)
@@ -0,0 +1,3 @@
+<INTERFACE>
+<OBJECT id="tree"/>
+</INTERFACE>

Deleted: trunk/LayoutTests/xmlviewer/extensions-api-expected.txt (151079 => 151080)


--- trunk/LayoutTests/xmlviewer/extensions-api-expected.txt	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/LayoutTests/xmlviewer/extensions-api-expected.txt	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1,3 +0,0 @@
-Tests extensions hooks in xml viewer.
-
-SUCCESS

Deleted: trunk/LayoutTests/xmlviewer/extensions-api.html (151079 => 151080)


--- trunk/LayoutTests/xmlviewer/extensions-api.html	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/LayoutTests/xmlviewer/extensions-api.html	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1,40 +0,0 @@
-<html>
-<head>
-    <script>
-        if (window.testRunner) {
-           testRunner.dumpAsText();
-           testRunner.setCanOpenWindows();
-           testRunner.waitUntilDone();
-        }
-
-        var xmlWindow;
-
-        function print(str)
-        {
-            document.getElementById('output').textContent = str;
-            xmlWindow.close();
-            testRunner.notifyDone();
-        }
-
-        function checkSourceXML()
-        {
-            var sourceXML = xmlWindow.document.getElementById('webkit-xml-viewer-source-xml');
-            if (sourceXML && sourceXML.firstChild.nodeName == 'root')
-                print('SUCCESS');
-            else
-                print('FAIL');
-        }
-
-        function onload()
-        {
-            xmlWindow = window.open('resources/sample.xml', "XMLViewerTestWindow");
-            xmlWindow._onAfterWebkitXMLViewerLoaded_ = checkSourceXML;
-        }
-
-    </script>
-</head>
-<body _onload_="onload();">
-    <p>Tests extensions hooks in xml viewer.</p>
-    <div id='output'></div>
-</body>
-</html>

Deleted: trunk/LayoutTests/xmlviewer/resources/sample.xml (151079 => 151080)


--- trunk/LayoutTests/xmlviewer/resources/sample.xml	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/LayoutTests/xmlviewer/resources/sample.xml	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1 +0,0 @@
-<root/>

Modified: trunk/Source/WebCore/ChangeLog (151079 => 151080)


--- trunk/Source/WebCore/ChangeLog	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/Source/WebCore/ChangeLog	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1,3 +1,23 @@
+2013-06-02  Alexey Proskuryakov  <[email protected]>
+
+        Unstyled XML viewer crashes when XML contains an element with id="tree"
+        https://bugs.webkit.org/show_bug.cgi?id=117117
+        <rdar://problem/13727267>
+
+        Reviewed by Darin Adler.
+
+        Test: http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml
+
+        * xml/XMLViewer.css: Removed the rule to hide source document, as we no longer
+        keep it in the tree.
+
+        * xml/XMLViewer.js:
+        (prepareWebKitXMLViewer): Make sourceXML a detached tree, as otherwise it can
+        have ID conflicts with elements we add.
+        (sourceXMLLoaded): Removed some commented out code. Removed code that was checking
+        whether an extension took over XML display, as it makes no sense to duplicate this
+        functionality in an extension.
+
 2013-06-01  Chris Fleizach  <[email protected]>
 
         WebKit ignores aria-hidden when traversing nodes for name calculation

Modified: trunk/Source/WebCore/xml/XMLViewer.css (151079 => 151080)


--- trunk/Source/WebCore/xml/XMLViewer.css	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/Source/WebCore/xml/XMLViewer.css	2013-06-02 08:14:48 UTC (rev 151080)
@@ -43,10 +43,6 @@
     font-size: 13px;
 }
 
-#webkit-xml-viewer-source-xml {
-    display: none;
-}
-
 .collapsible-content {
     margin-left: 1em;
 }

Modified: trunk/Source/WebCore/xml/XMLViewer.js (151079 => 151080)


--- trunk/Source/WebCore/xml/XMLViewer.js	2013-06-02 04:42:57 UTC (rev 151079)
+++ trunk/Source/WebCore/xml/XMLViewer.js	2013-06-02 08:14:48 UTC (rev 151080)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -27,6 +28,7 @@
  */
 
 var nodeParentPairs = [];
+var sourceXML;
 
 // Script entry point.
 
@@ -40,9 +42,7 @@
     head.appendChild(style);
     var body = createHTMLElement('body');
     html.appendChild(body);
-    var sourceXML = createHTMLElement('div');
-    sourceXML.id = 'webkit-xml-viewer-source-xml';
-    body.appendChild(sourceXML);
+    sourceXML = createHTMLElement('div');
 
     var child;
     while (child = document.firstChild) {
@@ -69,12 +69,6 @@
 
 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
-    //var style = document.head.firstChild;
-    //document.head.removeChild(style);
-    //document.head.appendChild(style);
     var root = document.getElementById('tree');
 
     for (var child = sourceXML.firstChild; child; child = child.nextSibling)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to