| OLD | NEW |
| 1 | 1 |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 var a = 1; | 8 var a = 1; |
| 9 function testFunction() | 9 function testFunction() |
| 10 { | 10 { |
| 11 var var1 = 2; | 11 var var1 = 2; |
| 12 var var2 = 3; | 12 var var2 = 3; |
| 13 var arr1 = [1,2,3]; | 13 var arr1 = [1,2,3]; |
| 14 var arr2 = new Uint8Array(new ArrayBuffer(Math.pow(2, 29))); | 14 var arr2 = new Uint8Array(new ArrayBuffer(Math.pow(2, 29))); |
| 15 debugger; | 15 debugger; |
| 16 } | 16 } |
| 17 | 17 |
| 18 function test() | 18 function test() |
| 19 { | 19 { |
| 20 InspectorTest.runDebuggerTestSuite([ | 20 InspectorTest.runDebuggerTestSuite([ |
| 21 function step1(next) | 21 function step1(next) |
| 22 { | 22 { |
| 23 InspectorTest.runTestFunctionAndWaitUntilPaused(next); | 23 InspectorTest.runTestFunctionAndWaitUntilPaused(next); |
| 24 }, | 24 }, |
| 25 | 25 |
| 26 function step2(next) | 26 function step2(next) |
| 27 { | 27 { |
| 28 Components.JavaScriptAutocomplete.completionsForExpression("", "var"
).then(checkAgainstGolden.bind(this, ["var1", "var2"], [], next)); | 28 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "var").
then(checkAgainstGolden.bind(this, ["var1", "var2"], [], next)); |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 function step3(next) | 31 function step3(next) |
| 32 { | 32 { |
| 33 Components.JavaScriptAutocomplete.completionsForExpression("", "di")
.then(checkAgainstGolden.bind(this, ["dir", "dirxml"], [], next)); | 33 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "di").t
hen(checkAgainstGolden.bind(this, ["dir", "dirxml"], [], next)); |
| 34 }, | 34 }, |
| 35 | 35 |
| 36 function step4(next) | 36 function step4(next) |
| 37 { | 37 { |
| 38 Components.JavaScriptAutocomplete.completionsForExpression("", "win"
).then(checkAgainstGolden.bind(this, ["window"], [], next)); | 38 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "win").
then(checkAgainstGolden.bind(this, ["window"], [], next)); |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 function step5(next) | 41 function step5(next) |
| 42 { | 42 { |
| 43 Components.JavaScriptAutocomplete.completionsForExpression("", "t").
then(checkAgainstGolden.bind(this, ["this"], [], next)); | 43 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "t").th
en(checkAgainstGolden.bind(this, ["this"], [], next)); |
| 44 }, | 44 }, |
| 45 | 45 |
| 46 function step6(next) | 46 function step6(next) |
| 47 { | 47 { |
| 48 Components.JavaScriptAutocomplete.completionsForExpression("var1.",
"toExp").then(checkAgainstGolden.bind(this, ["toExponential"], [], next)); | 48 ObjectUI.JavaScriptAutocomplete.completionsForExpression("var1.", "t
oExp").then(checkAgainstGolden.bind(this, ["toExponential"], [], next)); |
| 49 }, | 49 }, |
| 50 | 50 |
| 51 function step7(next) | 51 function step7(next) |
| 52 { | 52 { |
| 53 Components.JavaScriptAutocomplete.completionsForExpression("123.", "
toExp").then(checkAgainstGolden.bind(this, [], ["toExponential"], next)); | 53 ObjectUI.JavaScriptAutocomplete.completionsForExpression("123.", "to
Exp").then(checkAgainstGolden.bind(this, [], ["toExponential"], next)); |
| 54 }, | 54 }, |
| 55 | 55 |
| 56 function step8(next) | 56 function step8(next) |
| 57 { | 57 { |
| 58 Components.JavaScriptAutocomplete.completionsForExpression("", "").
then(checkAgainstGolden.bind(this, [], ["$"], next)); | 58 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "").th
en(checkAgainstGolden.bind(this, [], ["$"], next)); |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 function step9(next) | 61 function step9(next) |
| 62 { | 62 { |
| 63 Components.JavaScriptAutocomplete.completionsForExpression("", "", t
rue).then(checkAgainstGolden.bind(this, ["$", "window"], [], next)); | 63 ObjectUI.JavaScriptAutocomplete.completionsForExpression("", "", tru
e).then(checkAgainstGolden.bind(this, ["$", "window"], [], next)); |
| 64 }, | 64 }, |
| 65 | 65 |
| 66 function step10(next) | 66 function step10(next) |
| 67 { | 67 { |
| 68 Components.JavaScriptAutocomplete.completionsForExpression("console.
", "log('bar');").then(checkAgainstGolden.bind(this, [], ["$"], next)); | 68 ObjectUI.JavaScriptAutocomplete.completionsForExpression("console.",
"log('bar');").then(checkAgainstGolden.bind(this, [], ["$"], next)); |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 function step11(next) | 71 function step11(next) |
| 72 { | 72 { |
| 73 Components.JavaScriptAutocomplete.completionsForExpression("arr1.",
"").then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); | 73 ObjectUI.JavaScriptAutocomplete.completionsForExpression("arr1.", ""
).then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); |
| 74 }, | 74 }, |
| 75 | 75 |
| 76 function step12(next) | 76 function step12(next) |
| 77 { | 77 { |
| 78 Components.JavaScriptAutocomplete.completionsForExpression("arr1[",
"").then(checkAgainstGolden.bind(this, ["\"length\"]"], ["3]"], next)); | 78 ObjectUI.JavaScriptAutocomplete.completionsForExpression("arr1[", ""
).then(checkAgainstGolden.bind(this, ["\"length\"]"], ["3]"], next)); |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 function step13_ShouldNotCrash(next) | 81 function step13_ShouldNotCrash(next) |
| 82 { | 82 { |
| 83 Components.JavaScriptAutocomplete.completionsForExpression("arr2.",
"").then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); | 83 ObjectUI.JavaScriptAutocomplete.completionsForExpression("arr2.", "
").then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); |
| 84 }, | 84 }, |
| 85 | 85 |
| 86 function step14(next) | 86 function step14(next) |
| 87 { | 87 { |
| 88 Components.JavaScriptAutocomplete.completionsForExpression("document
\n","E").then(checkAgainstGolden.bind(this, ["Element"], ["ELEMENT_NODE"], next)
); | 88 ObjectUI.JavaScriptAutocomplete.completionsForExpression("document\n
","E").then(checkAgainstGolden.bind(this, ["Element"], ["ELEMENT_NODE"], next)); |
| 89 } | 89 } |
| 90 ]); | 90 ]); |
| 91 | 91 |
| 92 function checkAgainstGolden(golden, antiGolden, continuation, completions) | 92 function checkAgainstGolden(golden, antiGolden, continuation, completions) |
| 93 { | 93 { |
| 94 var suggestions = new Set(completions.map(s => s.text)) | 94 var suggestions = new Set(completions.map(s => s.text)) |
| 95 var failed = false; | 95 var failed = false; |
| 96 for (var i = 0; i < golden.length; ++i) { | 96 for (var i = 0; i < golden.length; ++i) { |
| 97 if (!suggestions.has(golden[i])) { | 97 if (!suggestions.has(golden[i])) { |
| 98 failed = true; | 98 failed = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 117 </script> | 117 </script> |
| 118 </head> | 118 </head> |
| 119 | 119 |
| 120 <body onload="runTest()"> | 120 <body onload="runTest()"> |
| 121 <p> | 121 <p> |
| 122 Test that completions in the context of the call frame will result in names | 122 Test that completions in the context of the call frame will result in names |
| 123 of its scope variables. | 123 of its scope variables. |
| 124 </p> | 124 </p> |
| 125 </body> | 125 </body> |
| 126 </html> | 126 </html> |
| OLD | NEW |