Skip to content

Commit bc221e2

Browse files
committed
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. Canonical link: https://commits.webkit.org/135381@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 9f74a5a commit bc221e2

9 files changed

Lines changed: 48 additions & 57 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2013-06-02 Alexey Proskuryakov <ap@apple.com>
2+
3+
Unstyled XML viewer crashes when XML contains an element with id="tree"
4+
https://bugs.webkit.org/show_bug.cgi?id=117117
5+
<rdar://problem/13727267>
6+
7+
Reviewed by Darin Adler.
8+
9+
* http/tests/xmlviewer/dumpAsText/existing-tree-element-crash-expected.txt: Added.
10+
* http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml: Added.
11+
12+
* xmlviewer: Removed.
13+
* xmlviewer/extensions-api-expected.txt: Removed.
14+
* xmlviewer/extensions-api.html: Removed.
15+
* xmlviewer/resources: Removed.
16+
* xmlviewer/resources/sample.xml: Removed.
17+
The "API" no longer exists.
18+
119
2013-06-01 Chris Fleizach <cfleizach@apple.com>
220

321
WebKit ignores aria-hidden when traversing nodes for name calculation
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This XML file does not appear to have any style information associated with it. The document tree is shown below.
2+
<INTERFACE>
3+
<OBJECT id="tree"/>
4+
</INTERFACE>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<INTERFACE>
2+
<OBJECT id="tree"/>
3+
</INTERFACE>

LayoutTests/xmlviewer/extensions-api-expected.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

LayoutTests/xmlviewer/extensions-api.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

LayoutTests/xmlviewer/resources/sample.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

Source/WebCore/ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2013-06-02 Alexey Proskuryakov <ap@apple.com>
2+
3+
Unstyled XML viewer crashes when XML contains an element with id="tree"
4+
https://bugs.webkit.org/show_bug.cgi?id=117117
5+
<rdar://problem/13727267>
6+
7+
Reviewed by Darin Adler.
8+
9+
Test: http/tests/xmlviewer/dumpAsText/existing-tree-element-crash.xml
10+
11+
* xml/XMLViewer.css: Removed the rule to hide source document, as we no longer
12+
keep it in the tree.
13+
14+
* xml/XMLViewer.js:
15+
(prepareWebKitXMLViewer): Make sourceXML a detached tree, as otherwise it can
16+
have ID conflicts with elements we add.
17+
(sourceXMLLoaded): Removed some commented out code. Removed code that was checking
18+
whether an extension took over XML display, as it makes no sense to duplicate this
19+
functionality in an extension.
20+
121
2013-06-01 Chris Fleizach <cfleizach@apple.com>
222

323
WebKit ignores aria-hidden when traversing nodes for name calculation

Source/WebCore/xml/XMLViewer.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ div.collapsible > div.hidden {
4343
font-size: 13px;
4444
}
4545

46-
#webkit-xml-viewer-source-xml {
47-
display: none;
48-
}
49-
5046
.collapsible-content {
5147
margin-left: 1em;
5248
}

Source/WebCore/xml/XMLViewer.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (C) 2011 Google Inc. All rights reserved.
3+
* Copyright (C) 2013 Apple Inc. All rights reserved.
34
*
45
* Redistribution and use in source and binary forms, with or without
56
* modification, are permitted provided that the following conditions are
@@ -27,6 +28,7 @@
2728
*/
2829

2930
var nodeParentPairs = [];
31+
var sourceXML;
3032

3133
// Script entry point.
3234

@@ -40,9 +42,7 @@ function prepareWebKitXMLViewer(noStyleMessage)
4042
head.appendChild(style);
4143
var body = createHTMLElement('body');
4244
html.appendChild(body);
43-
var sourceXML = createHTMLElement('div');
44-
sourceXML.id = 'webkit-xml-viewer-source-xml';
45-
body.appendChild(sourceXML);
45+
sourceXML = createHTMLElement('div');
4646

4747
var child;
4848
while (child = document.firstChild) {
@@ -69,12 +69,6 @@ function prepareWebKitXMLViewer(noStyleMessage)
6969

7070
function sourceXMLLoaded()
7171
{
72-
var sourceXML = document.getElementById('webkit-xml-viewer-source-xml');
73-
if (!sourceXML)
74-
return; // Stop if some XML tree extension is already processing this document
75-
//var style = document.head.firstChild;
76-
//document.head.removeChild(style);
77-
//document.head.appendChild(style);
7872
var root = document.getElementById('tree');
7973

8074
for (var child = sourceXML.firstChild; child; child = child.nextSibling)

0 commit comments

Comments
 (0)