| Index: third_party/WebKit/LayoutTests/inspector/sources/debugger/extract-javascript-identifiers.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger/extract-javascript-identifiers.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger/extract-javascript-identifiers.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..57fde3e0e2816a87c6bbe4ef8e829a6da7872580
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger/extract-javascript-identifiers.html
|
| @@ -0,0 +1,82 @@
|
| +<html>
|
| +<head>
|
| +<script src="../../../http/tests/inspector/inspector-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + var worker = WebInspector.SourceMapNamesResolverWorker._instance();
|
| +
|
| + InspectorTest.runTestSuite([
|
| + function testFunctionArguments(next)
|
| + {
|
| + extract("function foo(a, b) { }", next);
|
| + },
|
| +
|
| + function testSimpleVariable(next)
|
| + {
|
| + extract("function foo() { var a = 1; }", next);
|
| + },
|
| +
|
| + function testMemberExpression(next)
|
| + {
|
| + extract("function foo() { var a = b.c.d.e; }", next);
|
| + },
|
| +
|
| + function testFunctionCall(next)
|
| + {
|
| + extract("function foo() { var a = doSomething(b, true, 10); }", next);
|
| + },
|
| +
|
| + function testPropertyLiteral(next)
|
| + {
|
| + extract("function foo() { var a = b['test'];}", next);
|
| + },
|
| +
|
| + function testComputedProperty(next)
|
| + {
|
| + extract("function foo() { var a = b[variableName];}", next);
|
| + },
|
| +
|
| + function testNestedFunction1(next)
|
| + {
|
| + extract("function foo() { var a = 1; function bar() { var b = 1; } var c = 3;}", next);
|
| + },
|
| +
|
| + function testNestedFunction2(next)
|
| + {
|
| + extract("function foo() { var a = 1; var bar = function (){ var b = 1; }; var c = 3;}", next);
|
| + },
|
| +
|
| + function testNestedFunction3(next)
|
| + {
|
| + extract("function foo() { var a = x => x * 2 }", next);
|
| + },
|
| + ]);
|
| +
|
| + function extract(text, next)
|
| + {
|
| + InspectorTest.addResult("Text:");
|
| + InspectorTest.addResult(" " + text + "\n");
|
| + worker.javaScriptIdentifiers(text)
|
| + .then(onIdentifiers)
|
| + .then(next);
|
| + }
|
| +
|
| + function onIdentifiers(ids)
|
| + {
|
| + InspectorTest.addResult("Identifiers:");
|
| + for (var id of ids)
|
| + InspectorTest.addResult(` id: ${id.name} offset: ${id.offset}`);
|
| + }
|
| +}
|
| +
|
| +</script>
|
| +
|
| +</head>
|
| +
|
| +<body onload="runTest()">
|
| +<p>Tests the extraction of javascript identifier names from function text.</p>
|
| +
|
| +</body>
|
| +</html>
|
|
|