initial import
[vuplus_webkit] / Source / WebCore / manual-tests / inspector / bp-in-named-eval-after-reload.html
1 <style>code{background-color: #ffc;}</style>
2 <p><b>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=31375">Bug 31375</a> - Web Inspector: breakpoints in named evals are not restored after a reload</b>
3
4 <ul>
5 <li><p>open this page with Web Inspector
6 <li><p>switch to the Scripts panel, enabling debug if required
7 <li><p>the available scripts in the select element should be:
8 <ul>
9 <li>(program): f1.js
10 <li>(program): f2.js
11 <li>bp-in-named-eval-after-reload.html
12 </ul>
13 <li><p>In <code>(program) f1.js</code>, set a breakpoint on the first
14 executable line of the function <code>f1()</code>, the invocation of <code>doNothing()</code>.
15 <li><p>In <code>(program) f2.js</code>, set a breakpoint on the first
16 executable line of the function <code>f2()</code>, the invocation of <code>doNothing()</code>.
17 <li><p>click this button: <input id=button type=button value="click me">
18 <li><p>debugger should stop in the <code>f1()</code> function.
19 <li><p>resume the debugger
20 <li><p>debugger should stop in the <code>f2()</code> function (the function in <code>(program) f2.js</code>)
21 <li><p>resume the debugger
22 <li><p>switch to the web page, reload the web page, switch back to web inspector
23 <li><p>in the breakpoints sidebar panel, click on the two breakpoints listed
24 and the source for those functions should be shown in the source panel, and
25 the previous breakpoint markers should be visible
26 <li><p>click the "click me" button above, again
27 <li><p>debugger should stop in the <code>f1()</code> function.
28 <li><p>resume the debugger
29 <li><p>debugger should stop in the <code>f2()</code> function.
30 <li><p>resume the debugger
31 </ul>
32
33 <p>Note that without the fix in <a href="https://bugs.webkit.org/show_bug.cgi?id=31375">Bug 31375</a>,
34 the breakpoints won't work after reloading the page.
35
36 <script>
37
38 function doNothing() { /* allows multi-line functions, easier to debug */ };
39
40 eval([
41     "function f1() {",
42     "   doNothing();",
43     "   console.log(new Date() + ':  f1() called');",
44     "}",
45     "//@sourceURL=f1.js"
46 ].join("\n"));
47
48 f2 = Function([
49     "",
50     "   doNothing();",
51     "   console.log(new Date() + ':  f2() called');",
52     "//@sourceURL=f2.js"
53 ].join("\n"));
54
55 var button = document.getElementById("button");
56
57 button.addEventListener("click", clickHandler, false);
58
59 function clickHandler() {
60     f1();
61     f2();
62 }
63
64 </script>
65 <!-- End -->