| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 print("Tests that \"console.profileEnd()\" does not cause crash. (webkit:105759)
"); | |
| 6 | |
| 7 InspectorTest.evaluateInPage(` | |
| 8 function collectProfiles() | |
| 9 { | |
| 10 console.profile(); | |
| 11 console.profile("titled"); | |
| 12 console.profileEnd(); | |
| 13 console.profileEnd(); | |
| 14 }`); | |
| 15 | |
| 16 InspectorTest.fail = function(message) | |
| 17 { | |
| 18 InspectorTest.log("FAIL: " + message); | |
| 19 InspectorTest.completeTest(); | |
| 20 } | |
| 21 | |
| 22 InspectorTest.sendCommand("Profiler.enable", {}); | |
| 23 InspectorTest.sendCommand("Runtime.evaluate", { expression: "collectProfiles()"}
, didCollectProfiles); | |
| 24 | |
| 25 var headers = []; | |
| 26 InspectorTest.eventHandler["Profiler.consoleProfileFinished"] = function(message
Object) | |
| 27 { | |
| 28 headers.push({ | |
| 29 title: messageObject["params"]["title"] | |
| 30 }); | |
| 31 } | |
| 32 | |
| 33 function didCollectProfiles(messageObject) | |
| 34 { | |
| 35 if (headers.length !== 2) | |
| 36 return InspectorTest.fail("Cannot retrive headers: " + JSON.stringify(messag
eObject, null, 4)); | |
| 37 InspectorTest.log("SUCCESS: found 2 profile headers"); | |
| 38 for (var i = 0; i < headers.length; i++) { | |
| 39 if (headers[i].title === "titled") { | |
| 40 InspectorTest.log("SUCCESS: titled profile found"); | |
| 41 InspectorTest.completeTest(); | |
| 42 return; | |
| 43 } | |
| 44 } | |
| 45 InspectorTest.fail("Cannot find titled profile"); | |
| 46 } | |
| OLD | NEW |