Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-console-log-handle-navigate.js |
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-console-log-handle-navigate.js b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-console-log-handle-navigate.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7aca3c28932a4c2c9856fbb8928d896aac61581c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-console-log-handle-navigate.js |
@@ -0,0 +1,28 @@ |
+(async function(testRunner) { |
+ let {page, session, dp} = await testRunner.startBlank(`This tests how navigation is handled from inside debugger code (console.log).`); |
+ |
+ await session.evaluateAsync(` |
+ function appendIframe(url) { |
+ var frame = document.createElement('iframe'); |
+ frame.id = 'iframe'; |
+ frame.src = url; |
+ document.body.appendChild(frame); |
+ return new Promise(resolve => frame.onload = resolve); |
+ } |
+ appendIframe('${testRunner.url('../resources/console-log-navigate-on-load.html')}') |
+ `); |
+ |
+ await dp.Runtime.enable(); |
+ await checkExpression('logArray()'); |
+ await checkExpression('logDate()'); |
+ await checkExpression('logDateWithArg()'); |
+ testRunner.completeTest(); |
+ |
+ async function checkExpression(expression) { |
+ var contextId; |
+ dp.Runtime.onceExecutionContextCreated().then(result => contextId = result.params.context.id); |
+ await session.evaluateAsync(`appendIframe('${testRunner.url('../resources/console-log-navigate.html')}')`); |
+ testRunner.log(`Got new context: ${contextId !== undefined}`); |
+ testRunner.logMessage(await dp.Runtime.evaluate({ expression: expression, contextId: contextId })); |
+ } |
+}) |