зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1512437 - Part 2: Convert breakpoint APIs to be synchronous now that there are no sourcemaps. r=jlast
Differential Revision: https://phabricator.services.mozilla.com/D14628 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6b24ffee98
Коммит
67c9ac56bc
|
@ -470,33 +470,25 @@ const SourceActor = ActorClassWithSpec(sourceSpec, {
|
||||||
* A promise that resolves to a JSON object representing the
|
* A promise that resolves to a JSON object representing the
|
||||||
* response.
|
* response.
|
||||||
*/
|
*/
|
||||||
setBreakpoint: function(line, column, condition, noSliding, inNestedLoop) {
|
setBreakpoint: function(line, column, condition, noSliding) {
|
||||||
if (!inNestedLoop && this.threadActor.state !== "paused") {
|
|
||||||
const errorObject = {
|
|
||||||
error: "wrongState",
|
|
||||||
message: "Cannot set breakpoint while debuggee is running.",
|
|
||||||
};
|
|
||||||
throw errorObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
const location = new OriginalLocation(this, line, column);
|
const location = new OriginalLocation(this, line, column);
|
||||||
return this._getOrCreateBreakpointActor(
|
const actor = this._getOrCreateBreakpointActor(
|
||||||
location,
|
location,
|
||||||
condition,
|
condition,
|
||||||
noSliding
|
noSliding
|
||||||
).then((actor) => {
|
);
|
||||||
const response = {
|
|
||||||
actor: actor.actorID,
|
|
||||||
isPending: actor.isPending,
|
|
||||||
};
|
|
||||||
|
|
||||||
const actualLocation = actor.originalLocation;
|
const response = {
|
||||||
if (!actualLocation.equals(location)) {
|
actor: actor.actorID,
|
||||||
response.actualLocation = actualLocation.toJSON();
|
isPending: actor.isPending,
|
||||||
}
|
};
|
||||||
|
|
||||||
return response;
|
const actualLocation = actor.originalLocation;
|
||||||
});
|
if (!actualLocation.equals(location)) {
|
||||||
|
response.actualLocation = actualLocation.toJSON();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -591,7 +583,7 @@ const SourceActor = ActorClassWithSpec(sourceSpec, {
|
||||||
// GCed as well, and no scripts will exist on those lines
|
// GCed as well, and no scripts will exist on those lines
|
||||||
// anymore. We will never slide through a GCed script.
|
// anymore. We will never slide through a GCed script.
|
||||||
if (originalLocation.originalColumn || scripts.length === 0) {
|
if (originalLocation.originalColumn || scripts.length === 0) {
|
||||||
return Promise.resolve(actor);
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the script that spans the largest amount of code to
|
// Find the script that spans the largest amount of code to
|
||||||
|
@ -617,13 +609,14 @@ const SourceActor = ActorClassWithSpec(sourceSpec, {
|
||||||
// which means there must be valid entry points somewhere
|
// which means there must be valid entry points somewhere
|
||||||
// within those scripts.
|
// within those scripts.
|
||||||
if (actualLine > maxLine) {
|
if (actualLine > maxLine) {
|
||||||
return Promise.reject({
|
// eslint-disable-next-line no-throw-literal
|
||||||
|
throw {
|
||||||
error: "noCodeAtLineColumn",
|
error: "noCodeAtLineColumn",
|
||||||
message:
|
message:
|
||||||
"Could not find any entry points to set a breakpoint on, " +
|
"Could not find any entry points to set a breakpoint on, " +
|
||||||
"even though I was told a script existed on the line I started " +
|
"even though I was told a script existed on the line I started " +
|
||||||
"the search with.",
|
"the search with.",
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the actor to use the new location (reusing a
|
// Update the actor to use the new location (reusing a
|
||||||
|
@ -640,7 +633,7 @@ const SourceActor = ActorClassWithSpec(sourceSpec, {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve(actor);
|
return actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setBreakpointAtAllGeneratedLocations: function(actor, generatedLocations) {
|
_setBreakpointAtAllGeneratedLocations: function(actor, generatedLocations) {
|
||||||
|
|
|
@ -487,19 +487,19 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
line: generatedLine,
|
line: generatedLine,
|
||||||
column: generatedColumn,
|
column: generatedColumn,
|
||||||
};
|
};
|
||||||
|
const pkt = onPacket(packet);
|
||||||
|
|
||||||
Promise.resolve(onPacket(packet))
|
this.conn.send(pkt);
|
||||||
.catch(error => {
|
} catch (error) {
|
||||||
reportError(error);
|
reportError(error);
|
||||||
return {
|
this.conn.send({
|
||||||
error: "unknownError",
|
error: "unknownError",
|
||||||
message: error.message + "\n" + error.stack,
|
message: error.message + "\n" + error.stack,
|
||||||
};
|
});
|
||||||
})
|
return undefined;
|
||||||
.then(pkt => {
|
}
|
||||||
this.conn.send(pkt);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
try {
|
||||||
this._pushThreadPause();
|
this._pushThreadPause();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reportError(e, "Got an exception during TA__pauseAndRespond: ");
|
reportError(e, "Got an exception during TA__pauseAndRespond: ");
|
||||||
|
@ -1240,10 +1240,10 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
return res ? res : {};
|
return res ? res : {};
|
||||||
},
|
},
|
||||||
|
|
||||||
onSources: async function(request) {
|
onSources: function(request) {
|
||||||
await Promise.all(this.dbg.findSources().map(source => {
|
for (const source of this.dbg.findSources()) {
|
||||||
this.sources.createSourceActor(source);
|
this.sources.createSourceActor(source);
|
||||||
}));
|
}
|
||||||
|
|
||||||
// No need to flush the new source packets here, as we are sending the
|
// No need to flush the new source packets here, as we are sending the
|
||||||
// list of sources out immediately and we don't need to invoke the
|
// list of sources out immediately and we don't need to invoke the
|
||||||
|
@ -1963,9 +1963,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._onLoadBreakpointURLs.has(source.url)) {
|
if (this._onLoadBreakpointURLs.has(source.url)) {
|
||||||
this.unsafeSynchronize(
|
sourceActor.setBreakpoint(1);
|
||||||
sourceActor.setBreakpoint(1, undefined, undefined, undefined, true)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._debuggerSourcesSeen.add(source);
|
this._debuggerSourcesSeen.add(source);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче