mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 1013219) for apparently making test_ocsp_stapling_expired.js frequently time out
Backed out changeset a97c7103effe (bug 1013219) Backed out changeset a877772255f6 (bug 1013219)
This commit is contained in:
parent
f7c9e47ac9
commit
de3c97b5ab
@ -136,11 +136,11 @@ function test() {
|
||||
is(gEditor.getText().search(/debugger/), -1,
|
||||
"The second source is not displayed.");
|
||||
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
ok(isCaretPos(gPanel, 5),
|
||||
"Editor caret location is correct.");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
is(gEditor.getDebugLocation(), 4,
|
||||
"Editor debugger location is correct.");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
ok(gEditor.hasLineClass(4, "debug-line"),
|
||||
"The debugged line is highlighted appropriately (3).");
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,11 @@ function test() {
|
||||
"The second source is not displayed.");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
ok(isCaretPos(gPanel, 5),
|
||||
"Editor caret location is correct.");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
is(gEditor.getDebugLocation(), 4,
|
||||
"Editor debugger location is correct.");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
ok(gEditor.hasLineClass(4, "debug-line"),
|
||||
"The debugged line is highlighted appropriately.");
|
||||
|
||||
deferred.resolve();
|
||||
|
@ -36,13 +36,13 @@ function test() {
|
||||
let stepTests = [
|
||||
{key: 'VK_F11', keyRepeat: 1, caretLine: 16},
|
||||
{key: 'VK_F11', keyRepeat: 2, caretLine: 18},
|
||||
{key: 'VK_F11', keyRepeat: 2, caretLine: 27},
|
||||
{key: 'VK_F10', keyRepeat: 1, caretLine: 27},
|
||||
{key: 'VK_F11', keyRepeat: 1, caretLine: 18},
|
||||
{key: 'VK_F11', keyRepeat: 5, caretLine: 32},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 1, caretLine: 29},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 2, caretLine: 34},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 2, caretLine: 34}
|
||||
{key: 'VK_F11', keyRepeat: 2, caretLine: 26},
|
||||
{key: 'VK_F10', keyRepeat: 1, caretLine: 18},
|
||||
{key: 'VK_F11', keyRepeat: 1, caretLine: 19},
|
||||
{key: 'VK_F11', keyRepeat: 5, caretLine: 29},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 1, caretLine: 32},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 2, caretLine: 32},
|
||||
{key: 'VK_F11', modifier:'Shift', keyRepeat: 2, caretLine: 20}
|
||||
];
|
||||
// Trigger script that stops at debugger statement
|
||||
executeSoon(() => generateMouseClickInTab(gTab,
|
||||
|
@ -23,7 +23,7 @@ function test() {
|
||||
|
||||
function testNormalReturn() {
|
||||
waitForSourceAndCaretAndScopes(gPanel, ".html", 17).then(() => {
|
||||
waitForCaretAndScopes(gPanel, 20).then(() => {
|
||||
waitForCaretAndScopes(gPanel, 19).then(() => {
|
||||
let innerScope = gVars.getScopeAtIndex(0);
|
||||
let returnVar = innerScope.get("<return>");
|
||||
|
||||
|
@ -372,13 +372,10 @@ function attachTestThread(aClient, aTitle, aCallback) {
|
||||
// thread, and then resume it. Pass |aCallback| the thread's response to
|
||||
// the 'resume' packet, a TabClient for the tab, and a ThreadClient for the
|
||||
// thread.
|
||||
function attachTestTabAndResume(aClient, aTitle, aCallback = () => {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
function attachTestTabAndResume(aClient, aTitle, aCallback) {
|
||||
attachTestThread(aClient, aTitle, function(aResponse, aTabClient, aThreadClient) {
|
||||
aThreadClient.resume(function (aResponse) {
|
||||
aCallback(aResponse, aTabClient, aThreadClient);
|
||||
resolve([aResponse, aTabClient, aThreadClient]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -727,20 +724,6 @@ function stepIn(client, threadClient) {
|
||||
.then(() => paused);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume JS execution for a step over and wait for the pause after the step
|
||||
* has been taken.
|
||||
*
|
||||
* @param DebuggerClient client
|
||||
* @param ThreadClient threadClient
|
||||
* @returns Promise
|
||||
*/
|
||||
function stepOver(client, threadClient) {
|
||||
dumpn("Stepping over.");
|
||||
return threadClient.stepOver()
|
||||
.then(() => waitForPause(client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of `count` frames currently on stack, starting at the index
|
||||
* `first` for the specified thread.
|
||||
|
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
function f() {
|
||||
function g() { var a = 1; var b = 2; } g();
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var a = 1;
|
||||
var b = 2;
|
||||
|
||||
}
|
||||
|
||||
g();
|
||||
}
|
@ -39,68 +39,69 @@ function test_simple_breakpoint()
|
||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
||||
let location = { line: gDebuggee.line0 + 2 };
|
||||
|
||||
source.setBreakpoint(location, Task.async(function*(aResponse, bpClient) {
|
||||
const testCallbacks = [
|
||||
function(aPacket) {
|
||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the stepping worked.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Entered the foo function call frame.
|
||||
do_check_eq(aPacket.frame.where.line, location.line);
|
||||
do_check_neq(aPacket.why.type, "breakpoint");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
// At the end of the foo function call frame.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_neq(aPacket.why.type, "breakpoint");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the breakpoint wasn't the reason for this pause, but
|
||||
// that the frame is about to be popped while stepping.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_eq(aPacket.frame.where.line, location.line);
|
||||
do_check_neq(aPacket.why.type, "breakpoint");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// The foo function call frame was just popped from the stack.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.poppedFrames.length, 1);
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6);
|
||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
|
||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
];
|
||||
|
||||
for (let callback of testCallbacks) {
|
||||
let waiter = waitForPause(gThreadClient);
|
||||
gThreadClient.stepIn();
|
||||
let packet = yield waiter;
|
||||
callback(packet);
|
||||
}
|
||||
|
||||
// Remove the breakpoint and finish.
|
||||
let waiter = waitForPause(gThreadClient);
|
||||
gThreadClient.stepIn();
|
||||
yield waiter;
|
||||
bpClient.remove(() => gThreadClient.resume(() => gClient.close(gCallback)));
|
||||
}));
|
||||
|
||||
});
|
||||
// Step past the debugger statement.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
// Step into the debugger statement.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
// Get back to the frame above.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
// Step to the end of the function call frame.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
|
||||
// Step into the function call.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
// Step into the next line with the function call.
|
||||
gThreadClient.stepIn();
|
||||
});
|
||||
});
|
||||
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
|
@ -39,66 +39,67 @@ function test_simple_breakpoint()
|
||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
||||
let location = { line: gDebuggee.line0 + 2 };
|
||||
|
||||
source.setBreakpoint(location, Task.async(function*(aResponse, bpClient) {
|
||||
const testCallbacks = [
|
||||
function(aPacket) {
|
||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the stepping worked.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Reached the breakpoint.
|
||||
do_check_eq(aPacket.frame.where.line, location.line);
|
||||
do_check_eq(aPacket.why.type, "breakpoint");
|
||||
do_check_neq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
// Stepped to the closing brace of the function.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// The frame is about to be popped while stepping.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_eq(aPacket.frame.where.line, location.line);
|
||||
do_check_neq(aPacket.why.type, "breakpoint");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// The foo function call frame was just popped from the stack.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.poppedFrames.length, 1);
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6);
|
||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
function(aPacket) {
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
|
||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
},
|
||||
];
|
||||
|
||||
for (let callback of testCallbacks) {
|
||||
let waiter = waitForPause(gThreadClient);
|
||||
gThreadClient.stepOver();
|
||||
let packet = yield waiter;
|
||||
callback(packet);
|
||||
}
|
||||
|
||||
// Remove the breakpoint and finish.
|
||||
let waiter = waitForPause(gThreadClient);
|
||||
gThreadClient.stepOver();
|
||||
yield waiter;
|
||||
bpClient.remove(() => gThreadClient.resume(() => gClient.close(gCallback)));
|
||||
}));
|
||||
|
||||
});
|
||||
// Step past the debugger statement.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
// Step over the debugger statement.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
// Get back to the frame above.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
// Step to the end of the function call frame.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
// Step over the function call.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
// Step over to the next line with the function call.
|
||||
gThreadClient.stepOver();
|
||||
});
|
||||
});
|
||||
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
|
@ -38,7 +38,7 @@ function test_executable_lines() {
|
||||
do_check_true(!error);
|
||||
let source = gThreadClient.source(sources[0]);
|
||||
source.getExecutableLines(function(lines){
|
||||
do_check_true(arrays_equal([2, 5, 7, 8, 10, 12, 14, 16], lines));
|
||||
do_check_true(arrays_equal([2, 5, 7, 8, 12, 14, 16], lines));
|
||||
finishClient(gClient);
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
var SOURCE_URL = getFileUrl("setBreakpoint-on-line-with-no-offsets-at-end-of-script.js");
|
||||
|
||||
function run_test() {
|
||||
return Task.spawn(function* () {
|
||||
do_test_pending();
|
||||
|
||||
DebuggerServer.registerModule("xpcshell-test/testactors");
|
||||
DebuggerServer.init(() => true);
|
||||
|
||||
let global = createTestGlobal("test");
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
yield connect(client);
|
||||
|
||||
let { tabs } = yield listTabs(client);
|
||||
let tab = findTab(tabs, "test");
|
||||
let [, tabClient] = yield attachTab(client, tab);
|
||||
let [, threadClient] = yield attachThread(tabClient);
|
||||
yield resume(threadClient);
|
||||
|
||||
let promise = waitForNewSource(threadClient, SOURCE_URL);
|
||||
loadSubScript(SOURCE_URL, global);
|
||||
let { source } = yield promise;
|
||||
let sourceClient = threadClient.source(source);
|
||||
|
||||
let location = { line: 7 };
|
||||
let [packet, breakpointClient] = yield setBreakpoint(sourceClient, location);
|
||||
do_check_false(packet.isPending); // NOTE: Change this when bug 1148356 lands
|
||||
do_check_true("actualLocation" in packet);
|
||||
let actualLocation = packet.actualLocation;
|
||||
do_check_eq(actualLocation.line, 10);
|
||||
|
||||
packet = yield executeOnNextTickAndWaitForPause(function () {
|
||||
Cu.evalInSandbox("f()", global);
|
||||
}, client);
|
||||
do_check_eq(packet.type, "paused");
|
||||
let why = packet.why;
|
||||
do_check_eq(why.type, "breakpoint");
|
||||
do_check_eq(why.actors.length, 1);
|
||||
do_check_eq(why.actors[0], breakpointClient.actor);
|
||||
let where = packet.frame.where;
|
||||
do_check_eq(where.source.actor, source.actor);
|
||||
do_check_eq(where.line, actualLocation.line);
|
||||
|
||||
yield resume(threadClient);
|
||||
yield close(client);
|
||||
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
@ -38,7 +38,7 @@ function test_simple_stepping()
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check the return value.
|
||||
do_check_eq(aPacket.type, "paused");
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 4);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
// Check that stepping worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
|
@ -43,7 +43,7 @@ function test_simple_stepping()
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the return value is 10.
|
||||
do_check_eq(aPacket.type, "paused");
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 4);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.why.frameFinished.return, 10);
|
||||
|
||||
@ -51,7 +51,7 @@ function test_simple_stepping()
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
// Check that the return value is undefined.
|
||||
do_check_eq(aPacket.type, "paused");
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 8);
|
||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
|
||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
||||
do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
|
||||
|
||||
|
@ -1,92 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that stepping over an implicit return makes sense. Bug 1155966.
|
||||
*/
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gCallback;
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
run_test_with_server(DebuggerServer, function () {
|
||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||
});
|
||||
};
|
||||
|
||||
function run_test_with_server(aServer, aCallback) {
|
||||
gCallback = aCallback;
|
||||
initTestDebuggerServer(aServer);
|
||||
gDebuggee = addTestGlobal("test-stepping", aServer);
|
||||
gClient = new DebuggerClient(aServer.connectPipe());
|
||||
gClient.connect(testSteppingAndReturns);
|
||||
}
|
||||
|
||||
const testSteppingAndReturns = Task.async(function*() {
|
||||
const [attachResponse, tabClient, threadClient] = yield attachTestTabAndResume(gClient, "test-stepping");
|
||||
ok(!attachResponse.error, "Should not get an error attaching");
|
||||
|
||||
dumpn("Evaluating test code and waiting for first debugger statement");
|
||||
const dbgStmt1 = yield executeOnNextTickAndWaitForPause(evaluateTestCode, gClient)
|
||||
equal(dbgStmt1.frame.where.line, 3,
|
||||
"Should be at debugger statement on line 3")
|
||||
|
||||
dumpn("Testing stepping with implicit return");
|
||||
const step1 = yield stepOver(gClient, threadClient);
|
||||
equal(step1.frame.where.line, 4, "Should step to line 4");
|
||||
const step2 = yield stepOver(gClient, threadClient);
|
||||
equal(step2.frame.where.line, 7,
|
||||
"Should step to line 7, the implicit return at the last line of the function");
|
||||
// This assertion doesn't pass yet. You would need to do *another*
|
||||
// step at the end of this function to get the frameFinished.
|
||||
// See bug 923975.
|
||||
//
|
||||
// ok(step2.why.frameFinished, "This should be the implicit function return");
|
||||
|
||||
dumpn("Continuing and waiting for second debugger statement");
|
||||
const dbgStmt2 = yield resumeAndWaitForPause(gClient, threadClient);
|
||||
equal(dbgStmt2.frame.where.line, 12,
|
||||
"Should be at debugger statement on line 3")
|
||||
|
||||
dumpn("Testing stepping with explicit return");
|
||||
const step3 = yield stepOver(gClient, threadClient);
|
||||
equal(step3.frame.where.line, 13, "Should step to line 13");
|
||||
const step4 = yield stepOver(gClient, threadClient);
|
||||
equal(step4.frame.where.line, 15, "Should step out of the function from line 15");
|
||||
// This step is a bit funny, see bug 1013219 for details.
|
||||
const step5 = yield stepOver(gClient, threadClient);
|
||||
equal(step5.frame.where.line, 15, "Should step out of the function from line 15");
|
||||
ok(step5.why.frameFinished, "This should be the explicit function return");
|
||||
|
||||
finishClient(gClient, gCallback);
|
||||
});
|
||||
|
||||
function evaluateTestCode() {
|
||||
Cu.evalInSandbox(
|
||||
` // 1
|
||||
function implicitReturn() { // 2
|
||||
debugger; // 3
|
||||
if (this.someUndefinedProperty) { // 4
|
||||
yikes(); // 5
|
||||
} // 6
|
||||
} // 7
|
||||
// 8
|
||||
var yes = true; // 9
|
||||
function explicitReturn() { // 10
|
||||
if (yes) { // 11
|
||||
debugger; // 12
|
||||
return 1; // 13
|
||||
} // 14
|
||||
} // 15
|
||||
// 16
|
||||
implicitReturn(); // 17
|
||||
explicitReturn(); // 18
|
||||
`, // 19
|
||||
gDebuggee,
|
||||
"1.8",
|
||||
"test_stepping-07-test-code.js",
|
||||
1
|
||||
);
|
||||
}
|
@ -23,12 +23,14 @@ support-files =
|
||||
setBreakpoint-on-column-in-gcd-script.js
|
||||
setBreakpoint-on-column-with-no-offsets.js
|
||||
setBreakpoint-on-column-with-no-offsets-at-end-of-line.js
|
||||
setBreakpoint-on-column-with-no-offsets-at-end-of-script.js
|
||||
setBreakpoint-on-column-with-no-offsets-in-gcd-script.js
|
||||
setBreakpoint-on-line.js
|
||||
setBreakpoint-on-line-in-gcd-script.js
|
||||
setBreakpoint-on-line-with-multiple-offsets.js
|
||||
setBreakpoint-on-line-with-multiple-statements.js
|
||||
setBreakpoint-on-line-with-no-offsets.js
|
||||
setBreakpoint-on-line-with-no-offsets-at-end-of-script.js
|
||||
setBreakpoint-on-line-with-no-offsets-in-gcd-script.js
|
||||
|
||||
[test_ScriptStore.js]
|
||||
@ -203,7 +205,6 @@ reason = bug 820380
|
||||
[test_stepping-04.js]
|
||||
[test_stepping-05.js]
|
||||
[test_stepping-06.js]
|
||||
[test_stepping-07.js]
|
||||
[test_framebindings-01.js]
|
||||
[test_framebindings-02.js]
|
||||
[test_framebindings-03.js]
|
||||
@ -261,6 +262,7 @@ reason = bug 1014071
|
||||
[test_setBreakpoint-on-line-with-multiple-offsets.js]
|
||||
[test_setBreakpoint-on-line-with-multiple-statements.js]
|
||||
[test_setBreakpoint-on-line-with-no-offsets.js]
|
||||
[test_setBreakpoint-on-line-with-no-offsets-at-end-of-script.js]
|
||||
[test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js]
|
||||
[test_safe-getter.js]
|
||||
[test_client_close.js]
|
||||
|
@ -346,16 +346,12 @@ BytecodeCompiler::prepareAndEmitTree(ParseNode** ppn)
|
||||
{
|
||||
if (!FoldConstants(cx, ppn, parser.ptr()) ||
|
||||
!NameFunctions(cx, *ppn) ||
|
||||
!emitter->updateLocalsToFrameSlots())
|
||||
!emitter->updateLocalsToFrameSlots() ||
|
||||
!emitter->emitTree(*ppn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
emitter->setFunctionBodyEndPos((*ppn)->pn_pos);
|
||||
|
||||
if (!emitter->emitTree(*ppn))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -832,7 +828,7 @@ frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const cha
|
||||
MOZ_ASSERT(!options.forEval);
|
||||
BytecodeEmitter bce(/* parent = */ nullptr, &parser, pn->pn_funbox, script, lazy,
|
||||
/* insideEval = */ false, /* evalCaller = */ nullptr,
|
||||
/* insideNonGlobalEval = */ false, pn->pn_pos,
|
||||
/* insideNonGlobalEval = */ false, options.lineno,
|
||||
BytecodeEmitter::LazyFunction);
|
||||
if (!bce.init())
|
||||
return false;
|
||||
|
@ -143,27 +143,12 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
|
||||
insideEval(insideEval),
|
||||
insideNonGlobalEval(insideNonGlobalEval),
|
||||
insideModule(false),
|
||||
emitterMode(emitterMode),
|
||||
functionBodyEndPosSet(false)
|
||||
emitterMode(emitterMode)
|
||||
{
|
||||
MOZ_ASSERT_IF(evalCaller, insideEval);
|
||||
MOZ_ASSERT_IF(emitterMode == LazyFunction, lazyScript);
|
||||
}
|
||||
|
||||
BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
|
||||
Parser<FullParseHandler>* parser, SharedContext* sc,
|
||||
HandleScript script, Handle<LazyScript*> lazyScript,
|
||||
bool insideEval, HandleScript evalCaller,
|
||||
bool insideNonGlobalEval, TokenPos bodyPosition,
|
||||
EmitterMode emitterMode)
|
||||
: BytecodeEmitter(parent, parser, sc, script, lazyScript, insideEval,
|
||||
evalCaller, insideNonGlobalEval,
|
||||
parser->tokenStream.srcCoords.lineNum(bodyPosition.begin),
|
||||
emitterMode)
|
||||
{
|
||||
setFunctionBodyEndPos(bodyPosition);
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::init()
|
||||
{
|
||||
@ -3604,13 +3589,9 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
|
||||
switchToMain();
|
||||
}
|
||||
|
||||
setFunctionBodyEndPos(body->pn_pos);
|
||||
if (!emitTree(body))
|
||||
return false;
|
||||
|
||||
if (!updateSourceCoordNotes(body->pn_pos.end))
|
||||
return false;
|
||||
|
||||
if (sc->isFunctionBox()) {
|
||||
if (sc->asFunctionBox()->isGenerator()) {
|
||||
// If we fall off the end of a generator, do a final yield.
|
||||
@ -3710,7 +3691,6 @@ BytecodeEmitter::emitModuleScript(ParseNode* body)
|
||||
// may walk the scope chain of currently compiling scripts.
|
||||
JSScript::linkToModuleFromEmitter(cx, script, modulebox);
|
||||
|
||||
setFunctionBodyEndPos(body->pn_pos);
|
||||
if (!emitTree(body))
|
||||
return false;
|
||||
|
||||
@ -6430,9 +6410,10 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
|
||||
|
||||
script->bindings = funbox->bindings;
|
||||
|
||||
uint32_t lineNum = parser->tokenStream.srcCoords.lineNum(pn->pn_pos.begin);
|
||||
BytecodeEmitter bce2(this, parser, funbox, script, /* lazyScript = */ nullptr,
|
||||
insideEval, evalCaller,
|
||||
insideNonGlobalEval, pn->pn_pos, emitterMode);
|
||||
insideNonGlobalEval, lineNum, emitterMode);
|
||||
if (!bce2.init())
|
||||
return false;
|
||||
|
||||
@ -6803,13 +6784,6 @@ BytecodeEmitter::emitReturn(ParseNode* pn)
|
||||
return false;
|
||||
}
|
||||
|
||||
// We know functionBodyEndPos is set because "return" is only
|
||||
// valid in a function, and so we've passed through
|
||||
// emitFunctionScript.
|
||||
MOZ_ASSERT(functionBodyEndPosSet);
|
||||
if (!updateSourceCoordNotes(functionBodyEndPos))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* EmitNonLocalJumpFixup may add fixup bytecode to close open try
|
||||
* blocks having finally clauses and to exit intermingled let blocks.
|
||||
|
@ -234,11 +234,6 @@ struct BytecodeEmitter
|
||||
|
||||
const EmitterMode emitterMode;
|
||||
|
||||
// The end location of a function body that is being emitted.
|
||||
uint32_t functionBodyEndPos;
|
||||
// Whether functionBodyEndPos was set.
|
||||
bool functionBodyEndPosSet;
|
||||
|
||||
/*
|
||||
* Note that BytecodeEmitters are magic: they own the arena "top-of-stack"
|
||||
* space above their tempMark points. This means that you cannot alloc from
|
||||
@ -249,14 +244,6 @@ struct BytecodeEmitter
|
||||
HandleScript script, Handle<LazyScript*> lazyScript,
|
||||
bool insideEval, HandleScript evalCaller,
|
||||
bool insideNonGlobalEval, uint32_t lineNum, EmitterMode emitterMode = Normal);
|
||||
|
||||
// An alternate constructor that uses a TokenPos for the starting
|
||||
// line and that sets functionBodyEndPos as well.
|
||||
BytecodeEmitter(BytecodeEmitter* parent, Parser<FullParseHandler>* parser, SharedContext* sc,
|
||||
HandleScript script, Handle<LazyScript*> lazyScript,
|
||||
bool insideEval, HandleScript evalCaller,
|
||||
bool insideNonGlobalEval, TokenPos bodyPosition, EmitterMode emitterMode = Normal);
|
||||
|
||||
bool init();
|
||||
bool updateLocalsToFrameSlots();
|
||||
|
||||
@ -317,11 +304,6 @@ struct BytecodeEmitter
|
||||
unsigned currentLine() const { return current->currentLine; }
|
||||
unsigned lastColumn() const { return current->lastColumn; }
|
||||
|
||||
void setFunctionBodyEndPos(TokenPos pos) {
|
||||
functionBodyEndPos = pos.end;
|
||||
functionBodyEndPosSet = true;
|
||||
}
|
||||
|
||||
bool reportError(ParseNode* pn, unsigned errorNumber, ...);
|
||||
bool reportStrictWarning(ParseNode* pn, unsigned errorNumber, ...);
|
||||
bool reportStrictModeError(ParseNode* pn, unsigned errorNumber, ...);
|
||||
|
@ -3188,8 +3188,6 @@ Parser<ParseHandler>::functionArgsAndBodyGeneric(InHandling inHandling,
|
||||
return false;
|
||||
}
|
||||
|
||||
handler.setEndPosition(body, pos().begin);
|
||||
|
||||
return finishFunctionDefinition(pn, funbox, body);
|
||||
}
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
// Check that the line number reported at an onPop stop makes sense,
|
||||
// even when it happens on an "artificial" instruction.
|
||||
|
||||
var g = newGlobal();
|
||||
|
||||
// This bit of code arranges for the line number of the "artificial"
|
||||
// instruction to be something nonsensical -- the middle of a loop
|
||||
// which cannot be entered.
|
||||
g.eval(`function f() {
|
||||
debugger; // +0
|
||||
if(false) { // +1
|
||||
for(var b=0; b<0; b++) { // +2
|
||||
c = 2; // +3
|
||||
} // +4
|
||||
} // +5
|
||||
} // +6
|
||||
`);
|
||||
|
||||
var dbg = Debugger(g);
|
||||
|
||||
let debugLine;
|
||||
let foundLine;
|
||||
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
|
||||
frame.onPop = function(c) {
|
||||
foundLine = this.script.getOffsetLocation(this.offset).lineNumber;
|
||||
};
|
||||
};
|
||||
|
||||
g.eval("f();\n");
|
||||
|
||||
// The stop should happen on the closing brace of the function.
|
||||
assertEq(foundLine == debugLine + 6, true);
|
@ -33,4 +33,4 @@ dbg.onDebuggerStatement = function(frame) {
|
||||
|
||||
g.f();
|
||||
|
||||
assertEq(foundLines, ",1,2,3,4,5,6,7,8,10,11");
|
||||
assertEq(foundLines, ",1,2,3,4,5,6,7,8,10");
|
||||
|
@ -65,7 +65,7 @@ testOne("testTryFinally",
|
||||
} finally { // +6
|
||||
} // +7
|
||||
nothing(); // +8
|
||||
`, "1689");
|
||||
`, "168");
|
||||
|
||||
// The same but without a finally clause.
|
||||
testOne("testTryCatch",
|
||||
@ -74,7 +74,7 @@ testOne("testTryCatch",
|
||||
} catch (e) { // +6
|
||||
} // +7
|
||||
nothing(); // +8
|
||||
`, "189");
|
||||
`, "18");
|
||||
|
||||
// Test the instructions at the end of a "catch".
|
||||
testOne("testCatchFinally",
|
||||
@ -85,7 +85,7 @@ testOne("testCatchFinally",
|
||||
} finally { // +6
|
||||
} // +7
|
||||
nothing(); // +8
|
||||
`, "1689");
|
||||
`, "168");
|
||||
|
||||
// The same but without a finally clause. This relies on a
|
||||
// SpiderMonkey extension, because otherwise there's no way to see
|
||||
@ -98,7 +98,7 @@ testOne("testCatch",
|
||||
} catch (e) { // +6
|
||||
} // +7
|
||||
nothing(); // +8
|
||||
`, "189");
|
||||
`, "18");
|
||||
|
||||
// Test the instruction at the end of a "finally" clause.
|
||||
testOne("testFinally",
|
||||
@ -107,7 +107,7 @@ testOne("testFinally",
|
||||
${bitOfCode}
|
||||
} // +6
|
||||
nothing(); // +7
|
||||
`, "178");
|
||||
`, "17");
|
||||
|
||||
// Test the instruction at the end of a "then" clause.
|
||||
testOne("testThen",
|
||||
@ -116,7 +116,7 @@ testOne("testThen",
|
||||
} else { // +6
|
||||
} // +7
|
||||
nothing(); // +8
|
||||
`, "189");
|
||||
`, "18");
|
||||
|
||||
// Test the instructions leaving a switch block.
|
||||
testOne("testSwitch",
|
||||
@ -126,4 +126,4 @@ testOne("testSwitch",
|
||||
${bitOfCode}
|
||||
} // +6
|
||||
nothing(); // +7
|
||||
`, "178");
|
||||
`, "17");
|
||||
|
@ -1,29 +0,0 @@
|
||||
// Stepping over a not-taken "if" that is at the end of the function
|
||||
// should move to the end of the function, not somewhere in the body
|
||||
// of the "if".
|
||||
|
||||
var g = newGlobal();
|
||||
g.eval(`function f() { // 1
|
||||
var a,c; // 2
|
||||
debugger; // 3
|
||||
if(false) { // 4
|
||||
for(var b=0; b<0; b++) { // 5
|
||||
c = 2; // 6
|
||||
} // 7
|
||||
} // 8
|
||||
} // 9
|
||||
`);
|
||||
|
||||
var dbg = Debugger(g);
|
||||
var badStep = false;
|
||||
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
|
||||
assertEq(debugLine, 3);
|
||||
frame.onStep = function() {
|
||||
let foundLine = this.script.getOffsetLocation(this.offset).lineNumber;
|
||||
assertEq(foundLine <= 4 || foundLine >= 8, true);
|
||||
};
|
||||
};
|
||||
|
||||
g.eval("f();\n");
|
@ -1,34 +0,0 @@
|
||||
// Stepping through a function with a return statement should pause on
|
||||
// the closing brace of the function.
|
||||
|
||||
var g = newGlobal();
|
||||
var dbg = Debugger(g);
|
||||
var log;
|
||||
|
||||
function test(fnStr) {
|
||||
log = '';
|
||||
g.eval(fnStr);
|
||||
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
frame.onStep = function() {
|
||||
let {lineNumber, isEntryPoint} = frame.script.getOffsetLocation(frame.offset);
|
||||
if (isEntryPoint) {
|
||||
log += lineNumber + ' ';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
g.eval("f(23);");
|
||||
}
|
||||
|
||||
test("function f(x) {\n" + // 1
|
||||
" debugger;\n" + // 2
|
||||
" return 23 + x;\n" + // 3
|
||||
"}\n"); // 4
|
||||
assertEq(log, '3 4 ');
|
||||
|
||||
test("function f(x) {\n" + // 1
|
||||
" debugger;\n" + // 2
|
||||
" return;\n" + // 3
|
||||
"}\n"); // 4
|
||||
assertEq(log, '3 4 ');
|
@ -48,7 +48,7 @@ assertEq(Object.keys(offsets).length, 2);
|
||||
// have no effect on this one.
|
||||
doSingleStep = false;
|
||||
g.eval('t(0, 0, 0)');
|
||||
assertEq(Object.keys(offsets).length, 7);
|
||||
assertEq(Object.keys(offsets).length, 6);
|
||||
doSingleStep = true;
|
||||
|
||||
// Single-step in an eval frame. This should reach every line but the
|
||||
|
@ -16,4 +16,4 @@ Debugger(global).onDebuggerStatement = function (frame) {
|
||||
global.log = '';
|
||||
global.eval("function f(n) { for (var i = 0; i < n; ++i) log += '. '; log += '! '; } debugger;");
|
||||
global.f(3);
|
||||
assertEq(global.log, "25 32 44 . 39 32 44 . 39 32 44 . 39 32 57 ! 70 ");
|
||||
assertEq(global.log, "25 32 44 . 39 32 44 . 39 32 44 . 39 32 57 ! 69 ");
|
||||
|
@ -16,7 +16,7 @@ Debugger(global).onDebuggerStatement = function (frame) {
|
||||
global.log = "";
|
||||
global.eval("function ppppp() { return 1; }");
|
||||
// 1 2 3 4
|
||||
// 01234567890123456789012345678901234567890123456789
|
||||
// 0123456789012345678901234567890123456789012345678
|
||||
global.eval("function f(){ 1 && ppppp(ppppp()) && new Error() } debugger;");
|
||||
global.f();
|
||||
|
||||
@ -24,5 +24,5 @@ global.f();
|
||||
// 25 - Inner print()
|
||||
// 19 - Outer print()
|
||||
// 37 - new Error()
|
||||
// 49 - Exit the function body
|
||||
assertEq(global.log, "14 25 19 37 49 ");
|
||||
// 48 - Exit the function body
|
||||
assertEq(global.log, "14 25 19 37 48 ");
|
||||
|
@ -55,9 +55,7 @@ g.eval("/* Any copyright is dedicated to the Public Domain.\n" +
|
||||
" eval(\"42;\");\n" +
|
||||
" function foo() {}\n" +
|
||||
" if (true) {\n" +
|
||||
" foo();\n" +
|
||||
// The "missing" newline here is a trick to make a newline
|
||||
// source note come at the end. A real newline between the two
|
||||
// closing braces causes a setline note instead.
|
||||
" } }");
|
||||
test(g.secondCall, 8);
|
||||
" foo();\n" + // <- this is +6 and must be within the extent
|
||||
" }\n" +
|
||||
"}");
|
||||
test(g.secondCall, 7);
|
||||
|
Loading…
Reference in New Issue
Block a user