|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Test that optimized out variables aren't present in the variables view. |
|
5 |
|
6 function test() { |
|
7 Task.spawn(function* () { |
|
8 const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html"; |
|
9 let panel, debuggee, gDebugger, sources; |
|
10 |
|
11 let [, debuggee, panel] = yield initDebugger(TAB_URL); |
|
12 gDebugger = panel.panelWin; |
|
13 sources = gDebugger.DebuggerView.Sources; |
|
14 |
|
15 yield waitForSourceShown(panel, ".html"); |
|
16 yield panel.addBreakpoint({ url: sources.values[0], line: 18 }); |
|
17 yield ensureThreadClientState(panel, "resumed"); |
|
18 |
|
19 // Spin the event loop before causing the debuggee to pause, to allow |
|
20 // this function to return first. |
|
21 executeSoon(() => { |
|
22 EventUtils.sendMouseEvent({ type: "click" }, |
|
23 debuggee.document.querySelector("button"), |
|
24 debuggee); |
|
25 }); |
|
26 |
|
27 yield waitForDebuggerEvents(panel, gDebugger.EVENTS.FETCHED_SCOPES); |
|
28 let gVars = gDebugger.DebuggerView.Variables; |
|
29 let outerScope = gVars.getScopeAtIndex(1); |
|
30 outerScope.expand(); |
|
31 |
|
32 let upvarVar = outerScope.get("upvar"); |
|
33 ok(!upvarVar, "upvar was optimized out."); |
|
34 if (upvarVar) { |
|
35 ok(false, "upvar = " + upvarVar.target.querySelector(".value").getAttribute("value")); |
|
36 } |
|
37 |
|
38 let argVar = outerScope.get("arg"); |
|
39 is(argVar.target.querySelector(".name").getAttribute("value"), "arg", |
|
40 "Should have the right property name for |arg|."); |
|
41 is(argVar.target.querySelector(".value").getAttribute("value"), 42, |
|
42 "Should have the right property value for |arg|."); |
|
43 |
|
44 yield resumeDebuggerThenCloseAndFinish(panel); |
|
45 }).then(null, aError => { |
|
46 ok(false, "Got an error: " + aError.message + "\n" + aError.stack); |
|
47 }); |
|
48 } |