content/test/unit/test_delete_range.xml

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <?xml version="1.0" encoding="UTF-8"?>
michael@0 2 <!--
michael@0 3 This file holds serialized tests for DOM Range tests on extractContents.
michael@0 4 The <test/> elements designate individual tests. Each one has the following:
michael@0 5
michael@0 6 * A <source/> element, designating the start conditions of the test,
michael@0 7 * A <result/> element, designating what the source element should look like
michael@0 8 after the extraction,
michael@0 9 * An <extract/> element, designating what the extracted content should look like.
michael@0 10
michael@0 11 The <split/> element designates a split between two DOM nodes. This element will
michael@0 12 be removed before the actual test, and the two nodes on either side will not be
michael@0 13 merged.
michael@0 14
michael@0 15 The <empty-cdata/> element designates an empty character data section. Before
michael@0 16 the test executes, this element is replaced with an actual CDATASection node.
michael@0 17
michael@0 18 For the <source/> element, there are four attributes:
michael@0 19
michael@0 20 * startContainer: A XPath to the startContainer of the range.
michael@0 21 * endContainer: A XPath to the endContainer of the range.
michael@0 22 * startOffset: The startOffset of the range.
michael@0 23 * endOffset: The endOffset of the range.
michael@0 24
michael@0 25 Note this test may need updating with a fix for bug 401276. The spec states
michael@0 26 adjacent nodes after an extraction should be merged if possible, but using the
michael@0 27 normalize() method, which could have unintended side effects... For now, we're
michael@0 28 not permitting that, pending clarification.
michael@0 29
michael@0 30 Please make sure the first test in this document always tests a range where the
michael@0 31 start container and end container are the same text node, and where the start
michael@0 32 offset and end offsets are valid and inequal. Some of the additional range
michael@0 33 tests (after the bulk of the delete/extract tests) depend on it.
michael@0 34 -->
michael@0 35 <root>
michael@0 36 <!-- Extracting from a text node. -->
michael@0 37 <test>
michael@0 38 <source startContainer="text()[1]"
michael@0 39 endContainer="text()[1]"
michael@0 40 startOffset="4"
michael@0 41 endOffset="10">The quick fox</source>
michael@0 42 <result>The fox</result>
michael@0 43 <extract>quick </extract>
michael@0 44 </test>
michael@0 45
michael@0 46 <!-- Extracting from a CDATA section. -->
michael@0 47 <test>
michael@0 48 <source startContainer="text()[1]"
michael@0 49 endContainer="text()[1]"
michael@0 50 startOffset="4"
michael@0 51 endOffset="10"><![CDATA[The quick fox]]></source>
michael@0 52 <result><![CDATA[The fox]]></result>
michael@0 53 <extract><![CDATA[quick ]]></extract>
michael@0 54 </test>
michael@0 55
michael@0 56 <!-- Snipping the start of a text node. -->
michael@0 57 <test>
michael@0 58 <source startContainer="text()[1]"
michael@0 59 endContainer="text()[1]"
michael@0 60 startOffset="0"
michael@0 61 endOffset="4"><![CDATA[The quick fox]]></source>
michael@0 62 <result><![CDATA[quick fox]]></result>
michael@0 63 <extract><![CDATA[The ]]></extract>
michael@0 64 </test>
michael@0 65
michael@0 66 <!-- Extracting from a comment. -->
michael@0 67 <test>
michael@0 68 <source startContainer="comment()[1]"
michael@0 69 endContainer="comment()[1]"
michael@0 70 startOffset="4"
michael@0 71 endOffset="10"><!--The quick fox--></source>
michael@0 72 <result><!--The fox--></result>
michael@0 73 <extract><!--quick --></extract>
michael@0 74 </test>
michael@0 75
michael@0 76 <!-- Snipping whole nodes -->
michael@0 77 <test>
michael@0 78 <source startContainer="."
michael@0 79 endContainer="."
michael@0 80 startOffset="0"
michael@0 81 endOffset="2">Fox<fox/>Fox<bear/><!--comment--></source>
michael@0 82 <result>Fox<bear/><!--comment--></result>
michael@0 83 <extract>Fox<fox/></extract>
michael@0 84 </test>
michael@0 85
michael@0 86 <!-- Snipping whole nodes -->
michael@0 87 <test>
michael@0 88 <source startContainer="."
michael@0 89 endContainer="."
michael@0 90 startOffset="1"
michael@0 91 endOffset="3">Fox<fox/>Fox<bear/><!--comment--></source>
michael@0 92 <result>Fox<bear/><!--comment--></result>
michael@0 93 <extract><fox/>Fox</extract>
michael@0 94 </test>
michael@0 95
michael@0 96 <!-- Snipping a mixture of nodes and portions of text -->
michael@0 97 <test>
michael@0 98 <source startContainer="text()[2]"
michael@0 99 startOffset="1"
michael@0 100 endContainer="comment()[1]"
michael@0 101 endOffset="3">Fox<fox/>Fox<bear><?cow ?></bear><!--comment--></source>
michael@0 102 <result>Fox<fox/>F<!--ment--></result>
michael@0 103 <extract>ox<bear><?cow ?></bear><!--com--></extract>
michael@0 104 </test>
michael@0 105
michael@0 106 <!-- Extracting with a collapsed range from a text node. -->
michael@0 107 <test>
michael@0 108 <source startContainer="text()[1]"
michael@0 109 endContainer="text()[1]"
michael@0 110 startOffset="4"
michael@0 111 endOffset="4">The quick fox</source>
michael@0 112 <result>The quick fox</result>
michael@0 113 <extract/>
michael@0 114 </test>
michael@0 115
michael@0 116 <!-- Extracting with a collapsed range from a non-text node. -->
michael@0 117 <test>
michael@0 118 <source startContainer="."
michael@0 119 endContainer="."
michael@0 120 startOffset="0"
michael@0 121 endOffset="0">Fox<fox/>Fox<bear/><!--comment--></source>
michael@0 122 <result>Fox<fox/>Fox<bear/><!--comment--></result>
michael@0 123 <extract/>
michael@0 124 </test>
michael@0 125 </root>

mercurial