| 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, expandFirstArrayIndexFilter); |
| 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 expandFirstArrayIndexFilter(treeElement) |
| 50 { |
| 51 var propertyName = treeElement.nameElement && treeElement.nameElement.te
xtContent; |
| 52 return propertyName === "0"; |
| 53 } |
| 54 |
| 44 function countTextNodes(textContent) | 55 function countTextNodes(textContent) |
| 45 { | 56 { |
| 46 InspectorTest.disableConsoleViewport(); | 57 InspectorTest.disableConsoleViewport(); |
| 47 | 58 |
| 48 var count = 0; | 59 var count = 0; |
| 49 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa
ges; | 60 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa
ges; |
| 50 for (var i = 0; i < viewMessages.length; ++i) { | 61 for (var i = 0; i < viewMessages.length; ++i) { |
| 51 var node = viewMessages[i].contentElement(); | 62 var node = viewMessages[i].contentElement(); |
| 52 var currentNode = node; | 63 var currentNode = node; |
| 53 while (currentNode = currentNode.traverseNextNode(node)) { | 64 while (currentNode = currentNode.traverseNextNode(node)) { |
| 54 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV
alue === textContent) | 65 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV
alue === textContent) |
| 55 ++count; | 66 ++count; |
| 56 } | 67 } |
| 57 } | 68 } |
| 58 return count; | 69 return count; |
| 59 } | 70 } |
| 60 } | 71 } |
| 61 | 72 |
| 62 </script> | 73 </script> |
| 63 </head> | 74 </head> |
| 64 | 75 |
| 65 <body onload="runTest()"> | 76 <body onload="runTest()"> |
| 66 <p> | 77 <p> |
| 67 Tests that console logging dumps proper messages with broken Unicode. | 78 Tests that console logging dumps proper messages with broken Unicode. |
| 68 </p> | 79 </p> |
| 69 | 80 |
| 70 </body> | 81 </body> |
| 71 </html> | 82 </html> |
| OLD | NEW |