file_bug611182.sjs (7046B)
1 // SJS file for test_bug611182.html 2 "use strict"; 3 4 const TESTS = [ 5 { 6 ct: "text/html", 7 val: "<html contenteditable>fooz bar</html>", 8 }, 9 { 10 ct: "text/html", 11 val: "<html contenteditable><body>fooz bar</body></html>", 12 }, 13 { 14 ct: "text/html", 15 val: "<body contenteditable>fooz bar</body>", 16 }, 17 { 18 ct: "text/html", 19 val: "<body contenteditable><p>fooz bar</p></body>", 20 }, 21 { 22 ct: "text/html", 23 val: "<body contenteditable><div>fooz bar</div></body>", 24 }, 25 { 26 ct: "text/html", 27 val: "<body contenteditable><span>fooz bar</span></body>", 28 }, 29 { 30 ct: "text/html", 31 val: "<p contenteditable style='outline:none'>fooz bar</p>", 32 }, 33 { 34 ct: "text/html", 35 val: "<!DOCTYPE html><html><body contenteditable>fooz bar</body></html>", 36 }, 37 { 38 ct: "text/html", 39 val: "<!DOCTYPE html><html contenteditable><body>fooz bar</body></html>", 40 }, 41 { 42 ct: "application/xhtml+xml", 43 val: '<html xmlns="http://www.w3.org/1999/xhtml"><body contenteditable="true">fooz bar</body></html>', 44 }, 45 { 46 ct: "application/xhtml+xml", 47 val: '<html xmlns="http://www.w3.org/1999/xhtml" contenteditable="true"><body>fooz bar</body></html>', 48 }, 49 { 50 ct: "text/html", 51 val: "<body onload=\"document.designMode='on'\">fooz bar</body>", 52 }, 53 { 54 ct: "text/html", 55 val: 56 "<html><script>" + 57 "onload = function() {" + 58 "var old = document.body;" + 59 "old.parentNode.removeChild(old);" + 60 "var r = document.documentElement;" + 61 'var b = document.createElement("body");' + 62 "r.appendChild(b);" + 63 'b.appendChild(document.createTextNode("fooz bar"));' + 64 'b.contentEditable = "true";' + 65 "};" + 66 "</script><body></body></html>", 67 }, 68 { 69 ct: "text/html", 70 val: 71 "<html><script>" + 72 "onload = function() {" + 73 "var old = document.body;" + 74 "old.parentNode.removeChild(old);" + 75 "var r = document.documentElement;" + 76 'var b = document.createElement("body");' + 77 'b.appendChild(document.createTextNode("fooz bar"));' + 78 'b.contentEditable = "true";' + 79 "r.appendChild(b);" + 80 "};" + 81 "</script><body></body></html>", 82 }, 83 { 84 ct: "text/html", 85 val: 86 "<html><script>" + 87 "onload = function() {" + 88 "var old = document.body;" + 89 "old.parentNode.removeChild(old);" + 90 "var r = document.documentElement;" + 91 'var b = document.createElement("body");' + 92 "r.appendChild(b);" + 93 'b.appendChild(document.createTextNode("fooz bar"));' + 94 'b.setAttribute("contenteditable", "true");' + 95 "};" + 96 "</script><body></body></html>", 97 }, 98 { 99 ct: "text/html", 100 val: 101 "<html><script>" + 102 "onload = function() {" + 103 "var old = document.body;" + 104 "old.parentNode.removeChild(old);" + 105 "var r = document.documentElement;" + 106 'var b = document.createElement("body");' + 107 'b.appendChild(document.createTextNode("fooz bar"));' + 108 'b.setAttribute("contenteditable", "true");' + 109 "r.appendChild(b);" + 110 "};" + 111 "</script><body></body></html>", 112 }, 113 { 114 ct: "text/html", 115 val: 116 "<html><script>" + 117 "onload = function() {" + 118 "var old = document.body;" + 119 "old.parentNode.removeChild(old);" + 120 "var r = document.documentElement;" + 121 'var b = document.createElement("body");' + 122 "r.appendChild(b);" + 123 'b.contentEditable = "true";' + 124 'b.appendChild(document.createTextNode("fooz bar"));' + 125 "};" + 126 "</script><body></body></html>", 127 }, 128 { 129 ct: "text/html", 130 val: 131 "<html><script>" + 132 "onload = function() {" + 133 "var old = document.body;" + 134 "old.parentNode.removeChild(old);" + 135 "var r = document.documentElement;" + 136 'var b = document.createElement("body");' + 137 'b.contentEditable = "true";' + 138 "r.appendChild(b);" + 139 'b.appendChild(document.createTextNode("fooz bar"));' + 140 "};" + 141 "</script><body></body></html>", 142 }, 143 { 144 ct: "text/html", 145 val: 146 "<html><script>" + 147 "onload = function() {" + 148 "var old = document.body;" + 149 "old.parentNode.removeChild(old);" + 150 "var r = document.documentElement;" + 151 'var b = document.createElement("body");' + 152 "r.appendChild(b);" + 153 'b.setAttribute("contenteditable", "true");' + 154 'b.appendChild(document.createTextNode("fooz bar"));' + 155 "};" + 156 "</script><body></body></html>", 157 }, 158 { 159 ct: "text/html", 160 val: 161 "<html><script>" + 162 "onload = function() {" + 163 "var old = document.body;" + 164 "old.parentNode.removeChild(old);" + 165 "var r = document.documentElement;" + 166 'var b = document.createElement("body");' + 167 'b.setAttribute("contenteditable", "true");' + 168 "r.appendChild(b);" + 169 'b.appendChild(document.createTextNode("fooz bar"));' + 170 "};" + 171 "</script><body></body></html>", 172 }, 173 { 174 ct: "text/html", 175 val: 176 "<html><script>" + 177 "onload = function() {" + 178 "document.open();" + 179 'document.write("<body contenteditable>fooz bar</body>");' + 180 "document.close();" + 181 "};" + 182 "</script><body></body></html>", 183 }, 184 { 185 ct: "text/html", 186 val: 187 "data:text/html,<html><script>" + 188 "onload = function() {" + 189 "document.open();" + 190 'document.write("<body contenteditable><div>fooz bar</div></body>");' + 191 "document.close();" + 192 "};" + 193 "</script><body></body></html>", 194 }, 195 { 196 ct: "text/html", 197 val: 198 "<html><script>" + 199 "onload = function() {" + 200 "document.open();" + 201 'document.write("<body contenteditable><span>fooz bar</span></body>");' + 202 "document.close();" + 203 "};" + 204 "</script><body></body></html>", 205 }, 206 { 207 ct: "text/html", 208 val: 209 "<html><script>" + 210 "onload = function() {" + 211 "document.open();" + 212 'document.write("<p contenteditable style=\\"outline: none\\">fooz bar</p>");' + 213 "document.close();" + 214 "};" + 215 "</script><body></body></html>", 216 }, 217 { 218 ct: "text/html", 219 val: 220 "<html><script>" + 221 "onload = function() {" + 222 "document.open();" + 223 'document.write("<html contenteditable>fooz bar</html>");' + 224 "document.close();" + 225 "};" + 226 "</script><body></body></html>", 227 }, 228 { 229 ct: "text/html", 230 val: 231 "<html><script>" + 232 "onload = function() {" + 233 "document.open();" + 234 'document.write("<html contenteditable><body>fooz bar</body></html>");' + 235 "document.close();" + 236 "};" + 237 "</script><body></body></html>", 238 }, 239 ]; 240 241 function handleRequest(request, response) { 242 response.setHeader("Cache-Control", "no-cache", false); 243 244 let query = request.queryString; 245 if (query === "queryTotalTests") { 246 response.setHeader("Content-Type", "text/html", false); 247 response.write(TESTS.length); 248 return; 249 } 250 251 var curTest = TESTS[query]; 252 response.setHeader("Content-Type", curTest.ct, false); 253 response.write(curTest.val); 254 }