| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../network-test.js"></script> | 4 <script src="../network-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 function check(text) { | 9 function check(text) { |
| 10 InspectorTest.addResult(""); | 10 InspectorTest.addResult(""); |
| 11 InspectorTest.addResult("Input: " + text); | 11 InspectorTest.addResult("Input: " + text); |
| 12 var parsedJSON = WebInspector.RequestJSONView.parseJSON(text); | 12 var parsedJSON = WebInspector.RequestJSONView.parseJSON(text); |
| 13 if (!parsedJSON) { | 13 if (!parsedJSON) { |
| 14 InspectorTest.addResult("Can't parse"); | 14 InspectorTest.addResult("Can't parse"); |
| 15 return; | 15 return; |
| 16 } | 16 } |
| 17 InspectorTest.addResult("Prefix: " + parsedJSON.prefix); | 17 InspectorTest.addResult("Prefix: " + parsedJSON.prefix); |
| 18 InspectorTest.addResult("Data: " + JSON.stringify(parsedJSON.data)); | 18 InspectorTest.addResult("Data: " + JSON.stringify(parsedJSON.data)); |
| 19 InspectorTest.addResult("Suffix: " + parsedJSON.suffix); | 19 InspectorTest.addResult("Suffix: " + parsedJSON.suffix); |
| 20 } | 20 } |
| 21 | 21 |
| 22 check("{\"name\": \"value\"}"); | 22 check("{\"name\": \"value\"}"); |
| 23 check("while(1); {\"name\": \"value\"}"); | 23 check("while(1); {\"name\": \"value\"}"); |
| 24 check("[,\"foo\", -4.2, true, false, null]"); | 24 check("[, \"foo\", -4.2, true, false, null]"); |
| 25 check("[{\"foo\": {}, \"bar\": []},[[],{}]]"); | 25 check("[{\"foo\": {}, \"bar\": []},[[],{}]]"); |
| 26 check("/* vanilla */ run([1, 2, 3]);"); | 26 check("/* vanilla */ run ( [1, 2, 3] ) ;"); |
| 27 check("[\"A\\\"B\\u0020C\\nD\\\\E\\u04ABF\"]"); | 27 check("[\"A\\\"B\\u0020C\\nD\\\\E\\u04ABF\"]"); |
| 28 | 28 check("Text with with {}) inside"); |
| 29 check("<html>404 Page not found</html>"); | 29 check("<html>404 Page not found with foo({}) inside</html>"); |
| 30 check("/* vanilla prefix too large to be considered prefix Ok? */ run([1, 2,
3]); // since it is unlikely JSONP"); |
| 30 | 31 |
| 31 InspectorTest.completeTest(); | 32 InspectorTest.completeTest(); |
| 32 } | 33 } |
| 33 </script> | 34 </script> |
| 34 </head> | 35 </head> |
| 35 <body onload="runTest()"> | 36 <body onload="runTest()"> |
| 36 <p>Tests RequestJSONView ability to parse JSON passed in XHR, JSONP</p> | 37 <p>Tests RequestJSONView ability to parse JSON passed in XHR, JSONP</p> |
| 37 <a href="https://bugs.webkit.org/show_bug.cgi?id=65559">Bug 65559</a> | 38 <a href="https://bugs.webkit.org/show_bug.cgi?id=65559">Bug 65559</a> |
| 38 </body> | 39 </body> |
| 39 </html> | 40 </html> |
| OLD | NEW |