diff options
author | Alexey Kozyatinskiy <kozyatinskiy@chromium.org> | 2018-08-30 14:59:34 -0700 |
---|---|---|
committer | Alexey Kozyatinskiy <kozyatinskiy@chromium.org> | 2018-09-14 08:32:08 -0700 |
commit | 0827c80920311fa9d1e6989c8a73aaaeca962eb7 (patch) | |
tree | fc6a266f5330192a2f9c81a75b9ab91f06b827eb /test/sequential/test-inspector-resource-name-to-url.js | |
parent | cf340fe0f5201b77a6e9af7f3b3b82d0d4868fc3 (diff) | |
download | android-node-v8-0827c80920311fa9d1e6989c8a73aaaeca962eb7.tar.gz android-node-v8-0827c80920311fa9d1e6989c8a73aaaeca962eb7.tar.bz2 android-node-v8-0827c80920311fa9d1e6989c8a73aaaeca962eb7.zip |
inspector: implemented V8InspectorClient::resourceNameToUrl
This method is required by inspector to report normalized urls over
the protocol.
Fixes https://github.com/nodejs/node/issues/22223
PR-URL: https://github.com/nodejs/node/pull/22251
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'test/sequential/test-inspector-resource-name-to-url.js')
-rw-r--r-- | test/sequential/test-inspector-resource-name-to-url.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/sequential/test-inspector-resource-name-to-url.js b/test/sequential/test-inspector-resource-name-to-url.js new file mode 100644 index 0000000000..41a98ba219 --- /dev/null +++ b/test/sequential/test-inspector-resource-name-to-url.js @@ -0,0 +1,40 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +(async function test() { + const { strictEqual } = require('assert'); + const { Session } = require('inspector'); + const { promisify } = require('util'); + const vm = require('vm'); + const session = new Session(); + session.connect(); + session.post = promisify(session.post); + await session.post('Debugger.enable'); + await check('http://example.com', 'http://example.com'); + await check(undefined, 'evalmachine.<anonymous>'); + await check('file:///foo.js', 'file:///foo.js'); + await check('file:///foo.js', 'file:///foo.js'); + await check('foo.js', 'foo.js'); + await check('[eval]', '[eval]'); + await check('%.js', '%.js'); + + if (common.isWindows) { + await check('C:\\foo.js', 'file:///C:/foo.js'); + await check('C:\\a\\b\\c\\foo.js', 'file:///C:/a/b/c/foo.js'); + await check('a:\\%.js', 'file:///a:/%25.js'); + } else { + await check('/foo.js', 'file:///foo.js'); + await check('/a/b/c/d/foo.js', 'file:///a/b/c/d/foo.js'); + await check('/%%%.js', 'file:///%25%25%25.js'); + } + + async function check(filename, expected) { + const promise = + new Promise((resolve) => session.once('inspectorNotification', resolve)); + new vm.Script('42', { filename }).runInThisContext(); + const { params: { url } } = await promise; + strictEqual(url, expected); + } +})(); |