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>
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
6 <code>//@sourceURL=
</code> directive, some aren't. Some contain
7 <tt>debugger
</tt> commands, some don't.
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>
11 are not. The 'named' functions should show up in the Scripts select element used
12 to select a resource/script to view, the 'unnamed' ones should not.
15 <li><p>open this page with Web Inspector
16 <li><p>switch to the Scripts panel, enabling debug if required
17 <li><p>the available scripts in the select element should be:
19 <li>(program): f_named_1.eval
20 <li>(program): f_named_2.eval
21 <li>(program): f_named_3.eval
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
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>
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
30 in them. At that point, entries for these functions will be in the select element,
31 named:
"(program)". After pausing in both functions, there will be two
"(program)"
33 <li><p>you should be able to use the next/prev buttons (to the left of the select element)
34 to switch to other resources/scripts that have been opened, including the ones
35 containing these functions
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
38 stack trace entries to verify
39 <li><p>rather than stepping into the
<code>f_named_3()
</code> call, press the
41 <li><p>the debugger should stop in
<code>f_named_3()
</code> because of the
42 <code>debugger
</code> command
43 <li><p>rather than stepping into the
<code>f_unnamed_3()
</code> call, press 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
47 this function is added to the select element.
52 function doNothing() { /* allows multi-line functions, easier to debug */ };
55 "function f_named_1() {",
59 "//@sourceURL=f_named_1.eval"
63 "function f_unnamed_1() {",
65 " return 'unnamed_1';",
69 f_named_2
= Function([
73 "//@sourceURL=f_named_2.eval"
76 f_unnamed_2
= Function([
79 " return 'unnamed_2';"
82 f_named_3
= Function([
87 "//@sourceURL=f_named_3.eval"
90 f_unnamed_3
= Function([
94 " return 'unnamed_3';"
97 var button
= document
.getElementById("button");
99 button
.addEventListener("click", clickHandler
, false);
101 function clickHandler() {
108 // press "resume" at this point
109 console
.log("press resume before calling f_named_3()");
112 // press "resume" at this point
113 console
.log("press resume before calling f_unnamed_3()");