| 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="../timeline-test.js"></script> | 4 <script src="../timeline-test.js"></script> |
| 5 <script src="../network-test.js"></script> | 5 <script src="../network-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function performActions(callback) | 8 function performActions() |
| 9 { | 9 { |
| 10 var callback; |
| 11 var promise = new Promise((fulfill) => callback = fulfill); |
| 10 var xhr = new XMLHttpRequest(); | 12 var xhr = new XMLHttpRequest(); |
| 11 xhr.open("GET", "network/resources/resource.php", true); | 13 xhr.open("GET", "network/resources/resource.php", true); |
| 12 xhr.onload = callback; // This is necessary for XHRLoad event. | 14 xhr.onload = callback; // This is necessary for XHRLoad event. |
| 13 xhr.onreadystatechange = function () { }; // This is necessary for XHRReady
StateChange event. | 15 xhr.onreadystatechange = function () { }; // This is necessary for XHRReady
StateChange event. |
| 14 xhr.send(null); | 16 xhr.send(null); |
| 17 return promise; |
| 15 } | 18 } |
| 16 | 19 |
| 17 function test() | 20 function test() |
| 18 { | 21 { |
| 19 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 22 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 20 | 23 |
| 21 function finish() | 24 function finish() |
| 22 { | 25 { |
| 23 InspectorTest.printTimelineRecordsWithDetails("XHRReadyStateChange"); | 26 InspectorTest.printTimelineRecordsWithDetails("XHRReadyStateChange"); |
| 24 InspectorTest.printTimelineRecordsWithDetails("XHRLoad"); | 27 InspectorTest.printTimelineRecordsWithDetails("XHRLoad"); |
| 25 InspectorTest.completeTest(); | 28 InspectorTest.completeTest(); |
| 26 } | 29 } |
| 27 } | 30 } |
| 28 | 31 |
| 29 </script> | 32 </script> |
| 30 </head> | 33 </head> |
| 31 | 34 |
| 32 <body onload="runTest()"> | 35 <body onload="runTest()"> |
| 33 <p> | 36 <p> |
| 34 Tests the Timeline events for XMLHttpReqeust | 37 Tests the Timeline events for XMLHttpReqeust |
| 35 </p> | 38 </p> |
| 36 | 39 |
| 37 </body> | 40 </body> |
| 38 </html> | 41 </html> |
| OLD | NEW |