Bug 1530554 - Fix expression evaluation in worker threads; r=bhackett

Differential Revision: https://phabricator.services.mozilla.com/D21226

--HG--
extra : moz-landing-system : lando
This commit is contained in:
yulia 2019-02-26 15:58:21 +00:00
Родитель 20c9fd087e
Коммит 6b47255bce
2 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -37,7 +37,7 @@ export async function updateWorkerClients({
addThreadEventListeners(workerThread);
workerThread.resume();
const consoleFront = await tabTarget.getFront("console");
const consoleFront = await workerTargetFront.getFront("console");
await consoleFront.startListeners([]);
newWorkerClients[workerThread.actor] = {

Просмотреть файл

@ -16,6 +16,14 @@ function threadIsSelected(dbg, index) {
);
}
function getLabel(dbg, index) {
return findElement(dbg, "expressionNode", index).innerText;
}
function getValue(dbg, index) {
return findElement(dbg, "expressionValue", index).innerText;
}
// Test basic windowless worker functionality: the main thread and worker can be
// separately controlled from the same debugger.
add_task(async function() {
@ -45,10 +53,21 @@ add_task(async function() {
await waitForPaused(dbg, "simple-worker.js");
assertPausedAtSourceAndLine(dbg, workerSource.id, 3);
await addExpression(dbg, "count");
is(getLabel(dbg, 1), "count");
const v = getValue(dbg, 1);
ok(v == "" + +v, "Value of count should be a number");
info("Test stepping in a worker");
await stepOver(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 4);
// The watch expression should update with an incremented value.
await waitUntil(() => {
const v2 = getValue(dbg, 1);
return +v2 == +v + 1;
});
info("Test resuming in a worker");
await resume(dbg);
assertNotPaused(dbg);