mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 771452 - resume button need two clicks to go on after a breakpoint when the script is inside the .html file; r=rcampbell
This commit is contained in:
parent
229c763487
commit
fd456f8730
@ -58,6 +58,7 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_multiple-windows.js \
|
||||
browser_dbg_menustatus.js \
|
||||
browser_dbg_bfcache.js \
|
||||
browser_dbg_breakpoint-new-script.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
@ -76,6 +77,7 @@ MOCHITEST_BROWSER_PAGES = \
|
||||
browser_dbg_iframes.html \
|
||||
browser_dbg_with-frame.html \
|
||||
browser_dbg_pause-exceptions.html \
|
||||
browser_dbg_breakpoint-new-script.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
|
||||
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
function runDebuggerStatement() {
|
||||
debugger;
|
||||
}
|
||||
function myFunction() {
|
||||
var a = 1;
|
||||
debugger;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button type="button" onclick="myFunction()">Run</button>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,94 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 771452: make sure that setting a breakpoint in an inline script doesn't
|
||||
// add it twice.
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_breakpoint-new-script.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebugger = null;
|
||||
var gDebuggee = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.contentWindow;
|
||||
gDebuggee = aDebuggee;
|
||||
|
||||
testAddBreakpoint();
|
||||
});
|
||||
}
|
||||
|
||||
function testAddBreakpoint()
|
||||
{
|
||||
gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
executeSoon(function() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._frames;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"The debugger statement was reached.");
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
||||
"Should have one frame.");
|
||||
|
||||
let location = { url: TAB_URL, line: 9 };
|
||||
gPane.addBreakpoint(location, function (aResponse, bpClient) {
|
||||
testResume();
|
||||
});
|
||||
});
|
||||
}, false);
|
||||
|
||||
gDebuggee.runDebuggerStatement();
|
||||
}
|
||||
|
||||
function testResume()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function test() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function test() {
|
||||
executeSoon(testBreakpointHit);
|
||||
}, false);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
content.document.querySelector("button"),
|
||||
content.window);
|
||||
|
||||
});
|
||||
|
||||
gDebugger.DebuggerController.activeThread.resume();
|
||||
}
|
||||
|
||||
function testBreakpointHit()
|
||||
{
|
||||
var frames = gDebugger.DebuggerView.StackFrames._frames;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"The breakpoint was hit.");
|
||||
|
||||
resumeAndFinish();
|
||||
}
|
||||
|
||||
function resumeAndFinish() {
|
||||
let thread = gDebugger.DebuggerController.activeThread;
|
||||
thread.addOneTimeListener("paused", function test(aEvent, aPacket) {
|
||||
is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line.");
|
||||
isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
|
||||
thread.resume();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebugger = null;
|
||||
gDebuggee = null;
|
||||
});
|
@ -945,11 +945,13 @@ ThreadActor.prototype = {
|
||||
// Set any stored breakpoints.
|
||||
let existing = this._breakpointStore[aScript.url];
|
||||
if (existing) {
|
||||
let endLine = aScript.startLine + aScript.lineCount - 1;
|
||||
// Iterate over the lines backwards, so that sliding breakpoints don't
|
||||
// affect the loop.
|
||||
for (let line = existing.length - 1; line >= 0; line--) {
|
||||
let bp = existing[line];
|
||||
if (bp) {
|
||||
// Limit search to the line numbers contained in the new script.
|
||||
if (bp && line >= aScript.startLine && line <= endLine) {
|
||||
this._setBreakpoint(bp);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user