Bug 1543753 - Don't view sources that can't be loaded in the debugger, r=loganfsmyth.

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

--HG--
extra : rebase_source : 75e76b049d366b1324ea8fa1188fd4ea505c5348
This commit is contained in:
Brian Hackett 2019-05-01 14:01:09 -10:00
Родитель 11d65b993a
Коммит 13fb1413fb
3 изменённых файлов: 21 добавлений и 1 удалений

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

@ -162,6 +162,10 @@ DebuggerPanel.prototype = {
return this._actions.selectSource(cx, sourceId, { line, column });
},
canLoadSource(sourceId) {
return this._selectors.canLoadSource(this._getState(), sourceId);
},
getSourceByActorId(sourceId) {
return this._selectors.getSourceByActorId(this._getState(), sourceId);
},

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

@ -888,6 +888,22 @@ export function getSourceActorsForSource(
return getSourceActors(state, actors);
}
export function canLoadSource(state: OuterState, sourceId: string) {
// Return false if we know that loadSourceText() will fail if called on this
// source. This is used to avoid viewing such sources in the debugger.
const source = getSource(state, sourceId);
if (!source) {
return false;
}
if (isOriginalSource(source)) {
return true;
}
const actors = getSourceActorsForSource(state, sourceId);
return actors.length != 0;
}
export function getBreakpointPositions(
state: OuterState
): BreakpointPositionsMap {

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

@ -63,7 +63,7 @@ exports.viewSourceInDebugger = async function(
const dbg = await toolbox.loadTool("jsdebugger");
const source =
sourceId ? dbg.getSourceByActorId(sourceId) : dbg.getSourceByURL(sourceURL);
if (source) {
if (source && dbg.canLoadSource(source.id)) {
await toolbox.selectTool("jsdebugger", reason);
try {
await dbg.selectSource(source.id, sourceLine, sourceColumn);