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