mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 17:22:44 +00:00

This method is crucial for Runtime.evaluate protocol command with timeout flag. At least Chrome DevTools frontend uses this method for every execution in console. PR-URL: https://github.com/nodejs/node/pull/22383 Fixes: https://github.com/nodejs/node/issues/22157 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
22 lines
580 B
JavaScript
22 lines
580 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
(async function test() {
|
|
const { strictEqual } = require('assert');
|
|
const { Session } = require('inspector');
|
|
const { promisify } = require('util');
|
|
|
|
const session = new Session();
|
|
session.connect();
|
|
session.post = promisify(session.post);
|
|
const result = await session.post('Runtime.evaluate', {
|
|
expression: 'for(;;);',
|
|
timeout: 0
|
|
}).catch((e) => e);
|
|
strictEqual(result.message, 'Execution was terminated');
|
|
session.disconnect();
|
|
})();
|