| OLD | NEW |
| 1 | 1 |
| 2 <p><b>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=30212">Bug 30212
</a> - Each JS execution in console adds extra item into "scripts" combo</b> | 2 <p><b>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=30212">Bug 30212
</a> - Each JS execution in console adds extra item into "scripts" combo</b> |
| 3 | 3 |
| 4 <p>The following manual test creates functions via <tt>eval()</tt> and the | 4 <p>The following manual test creates functions via <tt>eval()</tt> and the |
| 5 <tt>Function()</tt> constructor, some functions are named using the | 5 <tt>Function()</tt> constructor, some functions are named using the |
| 6 <code>//@sourceURL=</code> directive, some aren't. Some contain | 6 <code>//# sourceURL=</code> directive, some aren't. Some contain |
| 7 <tt>debugger</tt> commands, some don't. | 7 <tt>debugger</tt> commands, some don't. |
| 8 | 8 |
| 9 <p>The functions named <tt>f_named_X</tt> are 'named' via the | 9 <p>The functions named <tt>f_named_X</tt> are 'named' via the |
| 10 <code>//@sourceURL=</code> directive, the ones named <tt>f_unnamed_X</tt> | 10 <code>//# sourceURL=</code> directive, the ones named <tt>f_unnamed_X</tt> |
| 11 are not. The 'named' functions should show up in the Scripts select element use
d | 11 are not. The 'named' functions should show up in the Scripts select element use
d |
| 12 to select a resource/script to view, the 'unnamed' ones should not. | 12 to select a resource/script to view, the 'unnamed' ones should not. |
| 13 | 13 |
| 14 <ul> | 14 <ul> |
| 15 <li><p>open this page with Web Inspector | 15 <li><p>open this page with Web Inspector |
| 16 <li><p>switch to the Scripts panel, enabling debug if required | 16 <li><p>switch to the Scripts panel, enabling debug if required |
| 17 <li><p>the available scripts in the select element should be: | 17 <li><p>the available scripts in the select element should be: |
| 18 <ul> | 18 <ul> |
| 19 <li>(program): f_named_1.eval | 19 <li>(program): f_named_1.eval |
| 20 <li>(program): f_named_2.eval | 20 <li>(program): f_named_2.eval |
| 21 <li>(program): f_named_3.eval | 21 <li>(program): f_named_3.eval |
| 22 <li>hidden-evals.html | 22 <li>hidden-evals.html |
| 23 </ul> | 23 </ul> |
| 24 <li><p>click this button: <input id=button type=button value="click me"> | 24 <li><p>click this button: <input id=button type=button value="click me"> |
| 25 <li><p>debugger should stop in the <code>clickHandler</code> function | 25 <li><p>debugger should stop in the <code>clickHandler</code> function |
| 26 <li><p>at this point, start stepping <b>into</b> the code | 26 <li><p>at this point, start stepping <b>into</b> the code |
| 27 <li><p>you should be able to step into functions <code>f_unnamed_1()</code> | 27 <li><p>you should be able to step into functions <code>f_unnamed_1()</code> |
| 28 and <code>f_unnamed_2()</code>. There are no resource/scripts in the | 28 and <code>f_unnamed_2()</code>. There are no resource/scripts in the |
| 29 select element that contain these functions, until you actually are paused | 29 select element that contain these functions, until you actually are paused |
| 30 in them. At that point, entries for these functions will be in the select eleme
nt, | 30 in them. At that point, entries for these functions will be in the select eleme
nt, |
| 31 named: "(program)". After pausing in both functions, there will be two "(progra
m)" | 31 named: "(program)". After pausing in both functions, there will be two "(progra
m)" |
| 32 entries. | 32 entries. |
| 33 <li><p>you should be able to use the next/prev buttons (to the left of the selec
t element) | 33 <li><p>you should be able to use the next/prev buttons (to the left of the selec
t element) |
| 34 to switch to other resources/scripts that have been opened, including the ones | 34 to switch to other resources/scripts that have been opened, including the ones |
| 35 containing these functions | 35 containing these functions |
| 36 <li><p>you should be able to click on the functions that exist in the 'hidden' | 36 <li><p>you should be able to click on the functions that exist in the 'hidden' |
| 37 resources from the Call Stack, and be shown the source; click around the | 37 resources from the Call Stack, and be shown the source; click around the |
| 38 stack trace entries to verify | 38 stack trace entries to verify |
| 39 <li><p>rather than stepping into the <code>f_named_3()</code> call, press the | 39 <li><p>rather than stepping into the <code>f_named_3()</code> call, press the |
| 40 resume button | 40 resume button |
| 41 <li><p>the debugger should stop in <code>f_named_3()</code> because of the | 41 <li><p>the debugger should stop in <code>f_named_3()</code> because of the |
| 42 <code>debugger</code> command | 42 <code>debugger</code> command |
| 43 <li><p>rather than stepping into the <code>f_unnamed_3()</code> call, press the | 43 <li><p>rather than stepping into the <code>f_unnamed_3()</code> call, press the |
| 44 resume button | 44 resume button |
| 45 <li><p>the debugger should stop in <code>f_unnamed_3()</code> because of the | 45 <li><p>the debugger should stop in <code>f_unnamed_3()</code> because of the |
| 46 <code>debugger</code> command. At this point, a third "(program)" entry for | 46 <code>debugger</code> command. At this point, a third "(program)" entry for |
| 47 this function is added to the select element. | 47 this function is added to the select element. |
| 48 </ul> | 48 </ul> |
| 49 | 49 |
| 50 <script> | 50 <script> |
| 51 | 51 |
| 52 function doNothing() { /* allows multi-line functions, easier to debug */ }; | 52 function doNothing() { /* allows multi-line functions, easier to debug */ }; |
| 53 | 53 |
| 54 eval([ | 54 eval([ |
| 55 "function f_named_1() {", | 55 "function f_named_1() {", |
| 56 " doNothing();", | 56 " doNothing();", |
| 57 " return 'named_1';", | 57 " return 'named_1';", |
| 58 "}", | 58 "}", |
| 59 "//@sourceURL=f_named_1.eval" | 59 "//# sourceURL=f_named_1.eval" |
| 60 ].join("\n")); | 60 ].join("\n")); |
| 61 | 61 |
| 62 eval([ | 62 eval([ |
| 63 "function f_unnamed_1() {", | 63 "function f_unnamed_1() {", |
| 64 " doNothing();", | 64 " doNothing();", |
| 65 " return 'unnamed_1';", | 65 " return 'unnamed_1';", |
| 66 "}" | 66 "}" |
| 67 ].join("\n")); | 67 ].join("\n")); |
| 68 | 68 |
| 69 f_named_2 = Function([ | 69 f_named_2 = Function([ |
| 70 "", | 70 "", |
| 71 " doNothing();", | 71 " doNothing();", |
| 72 " return 'named_2';", | 72 " return 'named_2';", |
| 73 "//@sourceURL=f_named_2.eval" | 73 "//# sourceURL=f_named_2.eval" |
| 74 ].join("\n")); | 74 ].join("\n")); |
| 75 | 75 |
| 76 f_unnamed_2 = Function([ | 76 f_unnamed_2 = Function([ |
| 77 "", | 77 "", |
| 78 " doNothing();", | 78 " doNothing();", |
| 79 " return 'unnamed_2';" | 79 " return 'unnamed_2';" |
| 80 ].join("\n")); | 80 ].join("\n")); |
| 81 | 81 |
| 82 f_named_3 = Function([ | 82 f_named_3 = Function([ |
| 83 "", | 83 "", |
| 84 " debugger;", | 84 " debugger;", |
| 85 " doNothing();", | 85 " doNothing();", |
| 86 " return 'named_3';", | 86 " return 'named_3';", |
| 87 "//@sourceURL=f_named_3.eval" | 87 "//# sourceURL=f_named_3.eval" |
| 88 ].join("\n")); | 88 ].join("\n")); |
| 89 | 89 |
| 90 f_unnamed_3 = Function([ | 90 f_unnamed_3 = Function([ |
| 91 "", | 91 "", |
| 92 " debugger;", | 92 " debugger;", |
| 93 " doNothing();", | 93 " doNothing();", |
| 94 " return 'unnamed_3';" | 94 " return 'unnamed_3';" |
| 95 ].join("\n")); | 95 ].join("\n")); |
| 96 | 96 |
| 97 var button = document.getElementById("button"); | 97 var button = document.getElementById("button"); |
| 98 | 98 |
| 99 button.addEventListener("click", clickHandler, false); | 99 button.addEventListener("click", clickHandler, false); |
| 100 | 100 |
| 101 function clickHandler() { | 101 function clickHandler() { |
| 102 debugger; | 102 debugger; |
| 103 f_named_1(); | 103 f_named_1(); |
| 104 f_unnamed_1(); | 104 f_unnamed_1(); |
| 105 f_named_2(); | 105 f_named_2(); |
| 106 f_unnamed_2(); | 106 f_unnamed_2(); |
| 107 | 107 |
| 108 // press "resume" at this point | 108 // press "resume" at this point |
| 109 console.log("press resume before calling f_named_3()"); | 109 console.log("press resume before calling f_named_3()"); |
| 110 f_named_3(); | 110 f_named_3(); |
| 111 | 111 |
| 112 // press "resume" at this point | 112 // press "resume" at this point |
| 113 console.log("press resume before calling f_unnamed_3()"); | 113 console.log("press resume before calling f_unnamed_3()"); |
| 114 f_unnamed_3(); | 114 f_unnamed_3(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 </script> | 117 </script> |
| 118 <!-- End --> | 118 <!-- End --> |
| OLD | NEW |