diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js')
-rw-r--r-- | devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js b/devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js new file mode 100644 index 000000000..bc116d443 --- /dev/null +++ b/devtools/client/webconsole/test/browser_eval_in_debugger_stackframe2.js @@ -0,0 +1,71 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test to make sure that web console commands can fire while paused at a +// breakpoint that was triggered from a JS call. Relies on asynchronous js +// evaluation over the protocol - see Bug 1088861. + +"use strict"; + +const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + + "test/test-eval-in-stackframe.html"; + +// Force the old debugger UI since it's directly used (see Bug 1301705) +Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); +registerCleanupFunction(function* () { + Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); +}); + +add_task(function* () { + yield loadTab(TEST_URI); + + info("open the web console"); + let hud = yield openConsole(); + let {jsterm} = hud; + + info("open the debugger"); + let {panelWin} = yield openDebugger(); + let {DebuggerController} = panelWin; + let {activeThread} = DebuggerController; + + let firstCall = promise.defer(); + let frameAdded = promise.defer(); + executeSoon(() => { + info("Executing firstCall"); + activeThread.addOneTimeListener("framesadded", () => { + executeSoon(frameAdded.resolve); + }); + jsterm.execute("firstCall()").then(firstCall.resolve); + }); + + info("Waiting for a frame to be added"); + yield frameAdded.promise; + + info("Executing basic command while paused"); + yield executeAndConfirm(jsterm, "1 + 2", "3"); + + info("Executing command using scoped variables while paused"); + yield executeAndConfirm(jsterm, "foo + foo2", + '"globalFooBug783499foo2SecondCall"'); + + info("Resuming the thread"); + activeThread.resume(); + + info("Checking the first command, which is the last to resolve since it " + + "paused"); + let node = yield firstCall.promise; + is(node.querySelector(".message-body").textContent, + "undefined", + "firstCall() returned correct value"); +}); + +function* executeAndConfirm(jsterm, input, output) { + info("Executing command `" + input + "`"); + + let node = yield jsterm.execute(input); + + is(node.querySelector(".message-body").textContent, output, + "Expected result from call to " + input); +} |