Index: third_party/WebKit/LayoutTests/inspector-protocol/cpu-profiler/console-profileEnd-parameterless-crash.js |
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/cpu-profiler/console-profileEnd-parameterless-crash.js b/third_party/WebKit/LayoutTests/inspector-protocol/cpu-profiler/console-profileEnd-parameterless-crash.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..232732952eed8244f8bba15306ad5e86372b8b0c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/cpu-profiler/console-profileEnd-parameterless-crash.js |
@@ -0,0 +1,38 @@ |
+(async function(testRunner) { |
+ // <a href='https://bugs.webkit.org/show_bug.cgi?id=105759'>Bug 105759.</a> |
+ let {page, session, dp} = await testRunner.startBlank('Tests that "console.profileEnd()" does not cause crash.\nBug 105759.'); |
+ |
+ function fail(message) { |
+ testRunner.log('FAIL: ' + message); |
+ testRunner.completeTest(); |
+ } |
+ |
+ var headers = []; |
+ dp.Profiler.onConsoleProfileFinished(messageObject => { |
+ headers.push({title: messageObject['params']['title']}); |
+ }); |
+ |
+ dp.Profiler.enable(); |
+ await session.evaluate(` |
+ (function collectProfiles() { |
+ console.profile(); |
+ console.profile('titled'); |
+ console.profileEnd(); |
+ console.profileEnd(); |
+ })(); |
+ `); |
+ |
+ |
+ if (headers.length !== 2) |
+ return fail('Cannot retrive headers: ' + JSON.stringify(messageObject, null, 4)); |
+ |
+ testRunner.log('SUCCESS: found 2 profile headers'); |
+ for (var i = 0; i < headers.length; i++) { |
+ if (headers[i].title === 'titled') { |
+ testRunner.log('SUCCESS: titled profile found'); |
+ testRunner.completeTest(); |
+ return; |
+ } |
+ } |
+ fail('Cannot find titled profile'); |
+}) |