diff options
Diffstat (limited to 'deps/v8/test/inspector/runtime/es6-module.js')
-rw-r--r-- | deps/v8/test/inspector/runtime/es6-module.js | 76 |
1 files changed, 47 insertions, 29 deletions
diff --git a/deps/v8/test/inspector/runtime/es6-module.js b/deps/v8/test/inspector/runtime/es6-module.js index 6d9e43486b..7108ba5aaf 100644 --- a/deps/v8/test/inspector/runtime/es6-module.js +++ b/deps/v8/test/inspector/runtime/es6-module.js @@ -21,41 +21,59 @@ export let a2 = 2`; var module3 = ` import { foo as foo1 } from 'module1'; import { foo as foo2 } from 'module2'; +// check that queryObjects works with JSModuleNamespace +import * as foo3 from 'module2'; console.log(foo1()); console.log(foo2()); import { a1 } from 'module1'; import { a2 } from 'module2'; debugger; +foo3; `; var module4 = '}'; -session.setupScriptMap(); -// We get scriptParsed events for modules .. -Protocol.Debugger.onScriptParsed(InspectorTest.logMessage); -// .. scriptFailed to parse for modules with syntax error .. -Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage); -// .. API messages from modules contain correct stack trace .. -Protocol.Runtime.onConsoleAPICalled(message => { - InspectorTest.log(`console.log(${message.params.args[0].value})`); - session.logCallFrames(message.params.stackTrace.callFrames); - InspectorTest.log(''); -}); -// .. we could break inside module and scope contains correct list of variables .. -Protocol.Debugger.onPaused(message => { - InspectorTest.logMessage(message); - Protocol.Runtime.getProperties({ objectId: message.params.callFrames[0].scopeChain[0].object.objectId}) - .then(InspectorTest.logMessage) - .then(() => Protocol.Debugger.resume()); -}); -// .. we process uncaught errors from modules correctly. -Protocol.Runtime.onExceptionThrown(InspectorTest.logMessage); - -Protocol.Runtime.enable(); -Protocol.Debugger.enable() - .then(() => contextGroup.addModule(module1, "module1")) - .then(() => contextGroup.addModule(module2, "module2")) - .then(() => contextGroup.addModule(module3, "module3")) - .then(() => contextGroup.addModule(module4, "module4")) - .then(() => InspectorTest.waitForPendingTasks()) - .then(InspectorTest.completeTest); +(async function test() { + session.setupScriptMap(); + // We get scriptParsed events for modules .. + Protocol.Debugger.onScriptParsed(InspectorTest.logMessage); + // .. scriptFailed to parse for modules with syntax error .. + Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage); + // .. API messages from modules contain correct stack trace .. + Protocol.Runtime.onConsoleAPICalled(message => { + InspectorTest.log(`console.log(${message.params.args[0].value})`); + session.logCallFrames(message.params.stackTrace.callFrames); + InspectorTest.log(''); + }); + // .. we could break inside module and scope contains correct list of variables .. + Protocol.Debugger.onPaused(message => { + InspectorTest.logMessage(message); + Protocol.Runtime.getProperties({ objectId: message.params.callFrames[0].scopeChain[0].object.objectId}) + .then(InspectorTest.logMessage) + .then(() => Protocol.Debugger.resume()); + }); + + // .. we process uncaught errors from modules correctly. + Protocol.Runtime.onExceptionThrown(InspectorTest.logMessage); + + Protocol.Runtime.enable(); + await Protocol.Debugger.enable(); + await contextGroup.addModule(module1, 'module1'); + await contextGroup.addModule(module2, 'module2'); + await contextGroup.addModule(module3, 'module3'); + await contextGroup.addModule(module4, 'module4'); + await InspectorTest.waitForPendingTasks(); + + Protocol.Debugger.onScriptParsed(null); + Protocol.Runtime.evaluate({ + includeCommandLineAPI: true, + expression: 'queryObjects(Function)' + }); + const {params:{object:{objectId}}} = await Protocol.Runtime.onceInspectRequested(); + const {result:{objects}} = await Protocol.Runtime.queryObjects({ + prototypeObjectId: objectId + }); + InspectorTest.log('queryObjects returns ' + objects.description.replace(/\d+/, 'N')); + + InspectorTest.completeTest(); +})(); |