| OLD | NEW | 
| (Empty) |  | 
 |   1 <html> | 
 |   2 <head> | 
 |   3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 
 |   4 <script> | 
 |   5  | 
 |   6 function test() | 
 |   7 { | 
 |   8     var worker = WebInspector.SourceMapNamesResolverWorker._instance(); | 
 |   9  | 
 |  10     InspectorTest.runTestSuite([ | 
 |  11         function testFunctionArguments(next) | 
 |  12         { | 
 |  13             extract("function foo(a, b) { }", next); | 
 |  14         }, | 
 |  15  | 
 |  16         function testSimpleVariable(next) | 
 |  17         { | 
 |  18             extract("function foo() { var a = 1; }", next); | 
 |  19         }, | 
 |  20  | 
 |  21         function testMemberExpression(next) | 
 |  22         { | 
 |  23             extract("function foo() { var a = b.c.d.e; }", next); | 
 |  24         }, | 
 |  25  | 
 |  26         function testFunctionCall(next) | 
 |  27         { | 
 |  28             extract("function foo() { var a = doSomething(b, true, 10); }", next
    ); | 
 |  29         }, | 
 |  30  | 
 |  31         function testPropertyLiteral(next) | 
 |  32         { | 
 |  33             extract("function foo() { var a = b['test'];}", next); | 
 |  34         }, | 
 |  35  | 
 |  36         function testComputedProperty(next) | 
 |  37         { | 
 |  38             extract("function foo() { var a = b[variableName];}", next); | 
 |  39         }, | 
 |  40  | 
 |  41         function testNestedFunction1(next) | 
 |  42         { | 
 |  43             extract("function foo() { var a = 1; function bar() { var b = 1; } v
    ar c = 3;}", next); | 
 |  44         }, | 
 |  45  | 
 |  46         function testNestedFunction2(next) | 
 |  47         { | 
 |  48             extract("function foo() { var a = 1; var bar = function (){ var b = 
    1; }; var c = 3;}", next); | 
 |  49         }, | 
 |  50  | 
 |  51         function testNestedFunction3(next) | 
 |  52         { | 
 |  53             extract("function foo() { var a = x => x * 2 }", next); | 
 |  54         }, | 
 |  55     ]); | 
 |  56  | 
 |  57     function extract(text, next) | 
 |  58     { | 
 |  59         InspectorTest.addResult("Text:"); | 
 |  60         InspectorTest.addResult("    " + text + "\n"); | 
 |  61         worker.javaScriptIdentifiers(text) | 
 |  62             .then(onIdentifiers) | 
 |  63             .then(next); | 
 |  64     } | 
 |  65  | 
 |  66     function onIdentifiers(ids) | 
 |  67     { | 
 |  68         InspectorTest.addResult("Identifiers:"); | 
 |  69         for (var id of ids) | 
 |  70             InspectorTest.addResult(`    id: ${id.name}    offset: ${id.offset}`
    ); | 
 |  71     } | 
 |  72 } | 
 |  73  | 
 |  74 </script> | 
 |  75  | 
 |  76 </head> | 
 |  77  | 
 |  78 <body onload="runTest()"> | 
 |  79 <p>Tests the extraction of javascript identifier names from function text.</p> | 
 |  80  | 
 |  81 </body> | 
 |  82 </html> | 
| OLD | NEW |