| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 var str = " \uD835\uDC14\uD835\uDC0D\uD835\uDC08\uD835\uDC02\uD835\uDC0E\uD835\
uDC03\uD835\uDC04"; // " UNICODE" | 7 var str = " \uD835\uDC14\uD835\uDC0D\uD835\uDC08\uD835\uDC02\uD835\uDC0E\uD835\
uDC03\uD835\uDC04"; // " UNICODE" |
| 8 var brokenSurrogate = str.substring(0, str.length - 1); | 8 var brokenSurrogate = str.substring(0, str.length - 1); |
| 9 var obj = { foo: brokenSurrogate }; | 9 var obj = { foo: brokenSurrogate }; |
| 10 obj[brokenSurrogate] = "foo"; | 10 obj[brokenSurrogate] = "foo"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 InspectorTest.waitForRemoteObjectsConsoleMessages(step2); | 22 InspectorTest.waitForRemoteObjectsConsoleMessages(step2); |
| 23 } | 23 } |
| 24 | 24 |
| 25 function step2() | 25 function step2() |
| 26 { | 26 { |
| 27 InspectorTest.expandConsoleMessages(step3); | 27 InspectorTest.expandConsoleMessages(step3); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function step3() | 30 function step3() |
| 31 { | 31 { |
| 32 InspectorTest.evaluateInPage("obj.foo", step4); | 32 InspectorTest.expandConsoleMessages(step4, nestedObjectFilter); |
| 33 } | 33 } |
| 34 | 34 |
| 35 function step4(result) | 35 function step4() |
| 36 { |
| 37 InspectorTest.evaluateInPage("obj.foo", step5); |
| 38 } |
| 39 |
| 40 function step5(result) |
| 36 { | 41 { |
| 37 var text = result.description; | 42 var text = result.description; |
| 38 InspectorTest.assertEquals(15, text.length, "text length"); | 43 InspectorTest.assertEquals(15, text.length, "text length"); |
| 39 InspectorTest.assertEquals(7, countTextNodes(text), "nodes count"); | 44 InspectorTest.assertEquals(6, countTextNodes(text), "nodes count"); |
| 40 InspectorTest.addResult("PASS: Found all nodes with the broken text"); | 45 InspectorTest.addResult("PASS: Found all nodes with the broken text"); |
| 41 InspectorTest.completeTest(); | 46 InspectorTest.completeTest(); |
| 42 } | 47 } |
| 43 | 48 |
| 49 function nestedObjectFilter(treeElement) |
| 50 { |
| 51 var name = treeElement.nameElement && treeElement.nameElement.textConten
t; |
| 52 var titleName = treeElement.treeOutline.titleElement && treeElement.tree
Outline.titleElement.textContent; |
| 53 return name === "0" || titleName === "Array[1]"; |
| 54 } |
| 55 |
| 44 function countTextNodes(textContent) | 56 function countTextNodes(textContent) |
| 45 { | 57 { |
| 46 InspectorTest.disableConsoleViewport(); | 58 InspectorTest.disableConsoleViewport(); |
| 47 | 59 |
| 48 var count = 0; | 60 var count = 0; |
| 49 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa
ges; | 61 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa
ges; |
| 50 for (var i = 0; i < viewMessages.length; ++i) { | 62 for (var i = 0; i < viewMessages.length; ++i) { |
| 51 var node = viewMessages[i].contentElement(); | 63 var node = viewMessages[i].contentElement(); |
| 52 var currentNode = node; | 64 var currentNode = node; |
| 53 while (currentNode = currentNode.traverseNextNode(node)) { | 65 while (currentNode = currentNode.traverseNextNode(node)) { |
| 54 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV
alue === textContent) | 66 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV
alue === textContent) |
| 55 ++count; | 67 ++count; |
| 56 } | 68 } |
| 57 } | 69 } |
| 58 return count; | 70 return count; |
| 59 } | 71 } |
| 60 } | 72 } |
| 61 | 73 |
| 62 </script> | 74 </script> |
| 63 </head> | 75 </head> |
| 64 | 76 |
| 65 <body onload="runTest()"> | 77 <body onload="runTest()"> |
| 66 <p> | 78 <p> |
| 67 Tests that console logging dumps proper messages with broken Unicode. | 79 Tests that console logging dumps proper messages with broken Unicode. |
| 68 </p> | 80 </p> |
| 69 | 81 |
| 70 </body> | 82 </body> |
| 71 </html> | 83 </html> |
| OLD | NEW |