Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger/extract-javascript-identifiers.html

Issue 1887913002: DevTools: improve identifier extraction in SourceMapNamesResolver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698